[PATCH 5 of 8] archival: flag missing files as a dirty wdir() in the metadata file (BC)

Matt Harbison mharbison72 at gmail.com
Sun Jul 9 19:42:13 EDT 2017


On Sun, 09 Jul 2017 19:34:53 -0400, Matt Harbison <mharbison72 at gmail.com>  
wrote:

> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1499582763 14400
> #      Sun Jul 09 02:46:03 2017 -0400
> # Node ID 81a3a3e44a191cfea66e25d472d65cce6cf2020d
> # Parent  3026ee006b20cf266d90181edbc9e2061cce8f92
> 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?

Or we could add another field ('identity'?), that is the equivalent of `hg  
id -i`, and avoid the BC.  That might be more useful (and solves the p1+p2  
inconsistency), especially if `hg id -i` is used for versioning.

> diff --git a/mercurial/archival.py b/mercurial/archival.py
> --- a/mercurial/archival.py
> +++ b/mercurial/archival.py
> @@ -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' % (
> diff --git a/tests/test-subrepo-deep-nested-change.t  
> b/tests/test-subrepo-deep-nested-change.t
> --- a/tests/test-subrepo-deep-nested-change.t
> +++ b/tests/test-subrepo-deep-nested-change.t
> @@ -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' .


More information about the Mercurial-devel mailing list