changeset 18137:d8e7b3a14957

strip: do not update branchcache during strip (issue3745) At this moment, the cache is invalid, and will be thrown away. Later the strip function will call the `localrepo.destroyed` method that will update the branchmap cache.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Fri, 28 Dec 2012 00:02:40 +0100
parents f23dea2b296e
children 11d1a9143adb
files mercurial/localrepo.py tests/test-keyword.t
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Wed Dec 26 15:04:07 2012 -0800
+++ b/mercurial/localrepo.py	Fri Dec 28 00:02:40 2012 +0100
@@ -2395,7 +2395,11 @@
             tr.close()
 
             if changesets > 0:
-                branchmap.updatecache(self)
+                if srctype != 'strip':
+                    # During strip, branchcache is invalid but coming call to
+                    # `destroyed` will repair it.
+                    # In other case we can safely update cache on disk.
+                    branchmap.updatecache(self)
                 def runhooks():
                     # forcefully update the on-disk branch cache
                     self.ui.debug("updating the branch cache\n")
--- a/tests/test-keyword.t	Wed Dec 26 15:04:07 2012 -0800
+++ b/tests/test-keyword.t	Fri Dec 28 00:02:40 2012 +0100
@@ -507,7 +507,6 @@
   $ hg -q commit -d '14 1' -m 'prepare amend'
 
   $ hg --debug commit --amend -d '15 1' -m 'amend without changes' | grep keywords
-  invalidating branch cache (tip differs)
   overwriting a expanding keywords
   $ hg -q id
   67d8c481a6be