manifest: use 't' for tree manifest flag
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 04 Dec 2015 14:24:45 -0800
changeset 27271 2a31433a59ba
parent 27270 ba5f20450b10
child 27272 69308357ecd1
manifest: use 't' for tree manifest flag 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.
mercurial/manifest.py
tests/test-treemanifest.t
--- a/mercurial/manifest.py	Sat Dec 05 23:06:03 2015 -0800
+++ b/mercurial/manifest.py	Fri Dec 04 14:24:45 2015 -0800
@@ -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)
 
--- a/tests/test-treemanifest.t	Sat Dec 05 23:06:03 2015 -0800
+++ b/tests/test-treemanifest.t	Fri Dec 04 14:24:45 2015 -0800
@@ -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     109      0       5 23d12a1f6e0e 000000000000 000000000000
+       0         0     127     -1       4 064927a0648a 000000000000 000000000000
+       1       127     111      0       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     109      0       5 23d12a1f6e0e 000000000000 000000000000
-       2       234      55      1       6 3cb2d87b4250 23d12a1f6e0e 000000000000
+       0         0     127     -1       4 064927a0648a 000000000000 000000000000
+       1       127     111      0       5 25ecb8cb8618 000000000000 000000000000
+       2       238      55      1       6 5b16163a30c6 25ecb8cb8618 000000000000
 
 Create deeper repo with tree manifests.