localrepo: update branchcache in a more reliable way
authorMads Kiilerich <mads@kiilerich.com>
Fri, 13 Jan 2012 02:29:38 +0100
changeset 15886 a5917346c72e
parent 15885 222fb8a512eb
child 15887 12dea4d998ec
localrepo: update branchcache in a more reliable way test-mq-cache.t did apparently look at stale cache content. Testing with different locking mechanism happened to update the cache more frequently and thus caused a test failure.
mercurial/localrepo.py
tests/test-fncache.t
tests/test-inherit-mode.t
tests/test-mq-caches.t
--- a/mercurial/localrepo.py	Fri Jan 13 01:19:08 2012 +0100
+++ b/mercurial/localrepo.py	Fri Jan 13 02:29:38 2012 +0100
@@ -1263,9 +1263,7 @@
                 # if minimal phase was 0 we don't need to retract anything
                 phases.retractboundary(self, targetphase, [n])
             tr.close()
-
-            if self._branchcache:
-                self.updatebranchcache()
+            self.updatebranchcache()
             return n
         finally:
             if tr:
--- a/tests/test-fncache.t	Fri Jan 13 01:19:08 2012 +0100
+++ b/tests/test-fncache.t	Fri Jan 13 02:29:38 2012 +0100
@@ -69,6 +69,8 @@
   .hg
   .hg/00changelog.i
   .hg/00manifest.i
+  .hg/cache
+  .hg/cache/branchheads
   .hg/data
   .hg/data/tst.d.hg
   .hg/data/tst.d.hg/foo.i
@@ -95,6 +97,8 @@
   $ find .hg | sort
   .hg
   .hg/00changelog.i
+  .hg/cache
+  .hg/cache/branchheads
   .hg/dirstate
   .hg/last-message.txt
   .hg/requires
--- a/tests/test-inherit-mode.t	Fri Jan 13 01:19:08 2012 +0100
+++ b/tests/test-inherit-mode.t	Fri Jan 13 02:29:38 2012 +0100
@@ -65,6 +65,8 @@
   $ python ../printmodes.py .
   00700 ./.hg/
   00600 ./.hg/00changelog.i
+  00770 ./.hg/cache/
+  00660 ./.hg/cache/branchheads
   00660 ./.hg/dirstate
   00660 ./.hg/last-message.txt
   00600 ./.hg/requires
--- a/tests/test-mq-caches.t	Fri Jan 13 01:19:08 2012 +0100
+++ b/tests/test-mq-caches.t	Fri Jan 13 02:29:38 2012 +0100
@@ -29,14 +29,16 @@
   $ hg qnew -d '0 0' p1
   $ show_branch_cache
   tip: 0
-  No branch cache
+  d986d5caac23a7d44a46efc0ddaf5eb9665844cf 0
+  d986d5caac23a7d44a46efc0ddaf5eb9665844cf default
 
   $ echo > pfile
   $ hg add pfile
   $ hg qrefresh -m 'patch 1'
   $ show_branch_cache
   tip: 0
-  No branch cache
+  a7977e38ed2c2942fa6c278030badfef3d180979 0
+  a7977e38ed2c2942fa6c278030badfef3d180979 default
 
 some regular revisions
 
@@ -65,8 +67,8 @@
   now at: p1
   $ show_branch_cache
   tip: 2
-  c229711f16da3d7591f89b1b8d963b79bda22714 1
-  c229711f16da3d7591f89b1b8d963b79bda22714 bar
+  982611f6955f9c48d3365decea203217c945ef0d 2
+  982611f6955f9c48d3365decea203217c945ef0d bar
   dc25e3827021582e979f600811852e36cbe57341 foo
 
   $ hg qnew -d '0 0' p2
@@ -75,8 +77,8 @@
   $ hg qrefresh -m 'patch 2'
   $ show_branch_cache 1
   tip: 3
-  c229711f16da3d7591f89b1b8d963b79bda22714 1
-  c229711f16da3d7591f89b1b8d963b79bda22714 bar
+  982611f6955f9c48d3365decea203217c945ef0d 2
+  982611f6955f9c48d3365decea203217c945ef0d bar
   dc25e3827021582e979f600811852e36cbe57341 foo
   branch foo: 3
   branch bar: 2
@@ -119,6 +121,6 @@
   now at: p2
   $ show_branch_cache
   tip: 3
-  dc25e3827021582e979f600811852e36cbe57341 0
-  dc25e3827021582e979f600811852e36cbe57341 foo
+  3fe2e3b237359b5c55cec6ed172ac41d3850fade 1
+  3fe2e3b237359b5c55cec6ed172ac41d3850fade foo