[PATCH] manifest: use 't' for tree manifest flag

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Dec 4 18:33:13 CST 2015



On 12/04/2015 02:28 PM, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # Date 1449267885 28800
> #      Fri Dec 04 14:24:45 2015 -0800
> # Node ID aca943a46fd3287ffcb9b585674c808ceaca2e5e
> # Parent  71aa5a26162d6e4a165b68f07b331e3e2eedc117
> manifest: use 't' for tree manifest flag

This seems fine by me, but I'll let Augie queue it.

>
> We currently use 'd' to indicate that a manifest entry is a
> directory. Let's switch to 't', since that's not a valid hex digit and
> therefore easier to spot in the raw manifest data.
>
> This will break any existing repos with tree manifests, but it's still
> an experimental feature and there are probably only a few test repos
> in existence with 'd' flags.
>
> diff --git a/mercurial/manifest.py b/mercurial/manifest.py
> --- a/mercurial/manifest.py
> +++ b/mercurial/manifest.py
> @@ -617,7 +617,7 @@
>
>       def setflag(self, f, flags):
>           """Set the flags (symlink, executable) for path f."""
> -        assert 'd' not in flags
> +        assert 't' not in flags
>           self._load()
>           dir, subpath = _splittopdir(f)
>           if dir:
> @@ -815,7 +815,7 @@
>
>       def parse(self, text, readsubtree):
>           for f, n, fl in _parse(text):
> -            if fl == 'd':
> +            if fl == 't':
>                   f = f + '/'
>                   self._dirs[f] = readsubtree(self._subpath(f), n)
>               elif '/' in f:
> @@ -846,7 +846,7 @@
>           """
>           self._load()
>           flags = self.flags
> -        dirs = [(d[:-1], self._dirs[d]._node, 'd') for d in self._dirs]
> +        dirs = [(d[:-1], self._dirs[d]._node, 't') for d in self._dirs]
>           files = [(f, self._files[f], flags(f)) for f in self._files]
>           return _text(sorted(dirs + files), usemanifestv2)
>
> diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t
> --- a/tests/test-treemanifest.t
> +++ b/tests/test-treemanifest.t
> @@ -32,7 +32,7 @@
>     $ hg debugdata -m 1
>     a\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (esc)
>     b\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (esc)
> -  dir1\x008b3ffd73f901e83304c83d33132c8e774ceac44ed (esc)
> +  dir1\x008b3ffd73f901e83304c83d33132c8e774ceac44et (esc)
>     e\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc)
>     $ hg debugdata --dir dir1 0
>     a\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc)
> @@ -124,11 +124,11 @@
>     $ hg debugindex --dir dir1
>        rev    offset  length  delta linkrev nodeid       p1           p2
>          0         0      54     -1       1 8b3ffd73f901 000000000000 000000000000
> -       1        54      68      0       2 b66d046c644f 8b3ffd73f901 000000000000
> -       2       122      12      1       4 b87265673c8a b66d046c644f 000000000000
> -       3       134      55      1       5 aa5d3adcec72 b66d046c644f 000000000000
> -       4       189      55      1       6 e29b066b91ad b66d046c644f 000000000000
> -       5       244      55      4       7 a120ce2b83f5 e29b066b91ad aa5d3adcec72
> +       1        54      68      0       2 68e9d057c5a8 8b3ffd73f901 000000000000
> +       2       122      12      1       4 4698198d2624 68e9d057c5a8 000000000000
> +       3       134      55      1       5 44844058ccce 68e9d057c5a8 000000000000
> +       4       189      55      1       6 bf3d9b744927 68e9d057c5a8 000000000000
> +       5       244      55      4       7 dde7c0af2a03 bf3d9b744927 44844058ccce
>
>   Merge keeping directory from parent 1 does not create revlog entry. (Note that
>   dir1's manifest does change, but only because dir1/a's filelog changes.)
> @@ -259,8 +259,8 @@
>          1        80      83      0       1 f3376063c255 40536115ed9e 000000000000
>          2       163      89      0       2 5d9b9da231a2 40536115ed9e 000000000000
>          3       252      83      2       3 d17d663cbd8a 5d9b9da231a2 f3376063c255
> -       4       335     124      1       4 c05a51345f86 f3376063c255 000000000000
> -       5       459     124      2       5 82594b1f557d 5d9b9da231a2 f3376063c255
> +       4       335     124      1       4 51e32a8c60ee f3376063c255 000000000000
> +       5       459     126      2       5 cc5baa78b230 5d9b9da231a2 f3376063c255
>
>
>   Status across flat/tree boundary should work
> @@ -275,15 +275,15 @@
>
>     $ hg debugindex .hg/store/meta/dir1/00manifest.i
>        rev    offset  length  delta linkrev nodeid       p1           p2
> -       0         0     125     -1       4 63c9c0557d24 000000000000 000000000000
> -       1       125     131     -1       5 23d12a1f6e0e 000000000000 000000000000
> +       0         0     127     -1       4 064927a0648a 000000000000 000000000000
> +       1       127     134     -1       5 25ecb8cb8618 000000000000 000000000000
>     $ echo 2 > dir1/a
>     $ hg --config experimental.treemanifest=False ci -qm 'modify dir1/a'
>     $ hg debugindex .hg/store/meta/dir1/00manifest.i
>        rev    offset  length  delta linkrev nodeid       p1           p2
> -       0         0     125     -1       4 63c9c0557d24 000000000000 000000000000
> -       1       125     131     -1       5 23d12a1f6e0e 000000000000 000000000000
> -       2       256      55      1       6 3cb2d87b4250 23d12a1f6e0e 000000000000
> +       0         0     127     -1       4 064927a0648a 000000000000 000000000000
> +       1       127     134     -1       5 25ecb8cb8618 000000000000 000000000000
> +       2       261      55      1       6 5b16163a30c6 25ecb8cb8618 000000000000
>
>   Create deeper repo with tree manifests.
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
>

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list