treemanifest: fix debugrebuildfncache
authorMartin von Zweigbergk <martinvonz@google.com>
Sun, 07 Feb 2016 21:44:38 -0800
changeset 29980 6f248ba853092fa90998f4c87374b9272c8371fe
parent 29979 ca2a0a654f54c3f790582c1a9eac60e0fc03382b
child 29981 8157c6b82f4003d870e0bcc40f8fbf3934f1e817
push id176
push usergszorc@mozilla.com
push dateTue, 16 Feb 2016 02:07:08 +0000
treemanifest: fix debugrebuildfncache When I taught debugrebuildfncache about dirlogs in fb92927f9775 (treemanifests: fix streaming clone, 2016-02-04), I added a last-minute "if 'treemanifest' in repo" guard. That should have been checking for "... in repo.requirements". Fix that and add tests for it.
mercurial/repair.py
tests/test-treemanifest.t
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -268,17 +268,17 @@ def rebuildfncache(ui, repo):
 
                 if repo.store._exists(i):
                     newentries.add(i)
                 if repo.store._exists(d):
                     newentries.add(d)
 
         ui.progress(_('changeset'), None)
 
-        if 'treemanifest' in repo: # safe but unnecessary otherwise
+        if 'treemanifest' in repo.requirements: # safe but unnecessary otherwise
             for dir in util.dirs(seenfiles):
                 i = 'meta/%s/00manifest.i' % dir
                 d = 'meta/%s/00manifest.d' % dir
 
                 if repo.store._exists(i):
                     newentries.add(i)
                 if repo.store._exists(d):
                     newentries.add(d)
--- a/tests/test-treemanifest.t
+++ b/tests/test-treemanifest.t
@@ -460,16 +460,49 @@ within that.
   $ cp -rT .hg/store-copy .hg/store
 
 Add some more changes to the deep repo
   $ echo narf >> b/bar/fruits.txt
   $ hg ci -m narf
   $ echo troz >> b/bar/orange/fly/gnat.py
   $ hg ci -m troz
 
+Verify works
+  $ hg verify
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  8 files, 3 changesets, 10 total revisions
+
+Dirlogs are included in fncache
+  $ grep meta/.A/00manifest.i .hg/store/fncache
+  meta/.A/00manifest.i
+
+Rebuilt fncache includes dirlogs
+  $ rm .hg/store/fncache
+  $ hg debugrebuildfncache
+  adding data/.A/one.txt.i
+  adding data/.A/two.txt.i
+  adding data/b/bar/fruits.txt.i
+  adding data/b/bar/orange/fly/gnat.py.i
+  adding data/b/bar/orange/fly/housefly.txt.i
+  adding data/b/foo/apple/bees/flower.py.i
+  adding data/c.txt.i
+  adding data/d.py.i
+  adding meta/.A/00manifest.i
+  adding meta/b/00manifest.i
+  adding meta/b/bar/00manifest.i
+  adding meta/b/bar/orange/00manifest.i
+  adding meta/b/bar/orange/fly/00manifest.i
+  adding meta/b/foo/00manifest.i
+  adding meta/b/foo/apple/00manifest.i
+  adding meta/b/foo/apple/bees/00manifest.i
+  16 items added, 0 removed from fncache
+
 Test cloning a treemanifest repo over http.
   $ hg serve -p $HGPORT2 -d --pid-file=hg.pid --errorlog=errors.log
   $ cat hg.pid >> $DAEMON_PIDS
   $ cd ..
 We can clone even with the knob turned off and we'll get a treemanifest repo.
   $ hg clone --config experimental.treemanifest=False \
   >   --config experimental.changegroup3=True \
   >   http://localhost:$HGPORT2 deepclone