archival: flag missing files as a dirty wdir() in the metadata file (BC)
authorMatt Harbison <matt_harbison@yahoo.com>
Sun, 09 Jul 2017 02:46:03 -0400
changeset 33363 3047167733dc
parent 33362 e48fb90f80c8
child 33364 bf2daeddd42b
archival: flag missing files as a dirty wdir() in the metadata file (BC) Since the identify command adds a '+' for missing files, it's reasonable that this does too. Perhaps the node field's hex value should be p1+p2 for merges?
mercurial/archival.py
tests/test-subrepo-deep-nested-change.t
--- a/mercurial/archival.py	Sun Jul 09 00:53:16 2017 -0400
+++ b/mercurial/archival.py	Sun Jul 09 02:46:03 2017 -0400
@@ -83,7 +83,7 @@
     hex = ctx.hex()
     if ctx.rev() is None:
         hex = ctx.p1().hex()
-        if ctx.dirty():
+        if ctx.dirty(missing=True):
             hex += '+'
 
     base = 'repo: %s\nnode: %s\nbranch: %s\n' % (
--- a/tests/test-subrepo-deep-nested-change.t	Sun Jul 09 00:53:16 2017 -0400
+++ b/tests/test-subrepo-deep-nested-change.t	Sun Jul 09 02:46:03 2017 -0400
@@ -238,6 +238,31 @@
   committing subrepository sub1
   committing subrepository sub1/sub2 (glob)
 
+  $ rm -r main
+  $ hg archive -S -qr 'wdir()' ../wdir
+  $ cat ../wdir/.hg_archival.txt
+  repo: 7f491f53a367861f47ee64a80eb997d1f341b77a
+  node: 9bb10eebee29dc0f1201dcf5977b811a540255fd+
+  branch: default
+  latesttag: null
+  latesttagdistance: 4
+  changessincelatesttag: 4
+  $ hg update -Cq .
+
+TODO: add the dirty flag for missing subrepo files
+
+  $ rm -r ../wdir sub1/sub2/folder/test.txt
+  $ hg archive -S -qr 'wdir()' ../wdir
+  $ cat ../wdir/.hg_archival.txt
+  repo: 7f491f53a367861f47ee64a80eb997d1f341b77a
+  node: 9bb10eebee29dc0f1201dcf5977b811a540255fd
+  branch: default
+  latesttag: null
+  latesttagdistance: 4
+  changessincelatesttag: 4
+  $ hg update -Cq .
+  $ rm -r ../wdir
+
 .. but first take a detour through some deep removal testing
 
   $ hg remove -S -I 're:.*.txt' .