mercurial/archival.py
changeset 25615 dc707fb35550
parent 25601 3ec8351fa6ed
child 25658 e93036747902
--- a/mercurial/archival.py	Mon Jun 15 16:06:17 2015 -0700
+++ b/mercurial/archival.py	Tue Jun 16 23:14:45 2015 -0400
@@ -67,8 +67,14 @@
 def buildmetadata(ctx):
     '''build content of .hg_archival.txt'''
     repo = ctx.repo()
+    hex = ctx.hex()
+    if ctx.rev() is None:
+        hex = ctx.p1().hex()
+        if ctx.dirty():
+            hex += '+'
+
     base = 'repo: %s\nnode: %s\nbranch: %s\n' % (
-        _rootctx(repo).hex(), ctx.hex(), encoding.fromlocal(ctx.branch()))
+        _rootctx(repo).hex(), hex, encoding.fromlocal(ctx.branch()))
 
     tags = ''.join('tag: %s\n' % t for t in ctx.tags()
                    if repo.tagtype(t) == 'global')