[PATCH 14 of 19] localrepo: update branchcache in a more reliable way

Mads Kiilerich mads at kiilerich.com
Thu Jan 12 19:32:48 CST 2012


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1326418178 -3600
# Node ID 342cbabf227347bd3cd65464ce9a19980df0be9b
# Parent  c34a911c2f744d0b4a441c657b2af7fd99caac32
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.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -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:
diff --git a/tests/test-fncache.t b/tests/test-fncache.t
--- a/tests/test-fncache.t
+++ b/tests/test-fncache.t
@@ -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
diff --git a/tests/test-inherit-mode.t b/tests/test-inherit-mode.t
--- a/tests/test-inherit-mode.t
+++ b/tests/test-inherit-mode.t
@@ -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
diff --git a/tests/test-mq-caches.t b/tests/test-mq-caches.t
--- a/tests/test-mq-caches.t
+++ b/tests/test-mq-caches.t
@@ -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
 


More information about the Mercurial-devel mailing list