branchmap: improve invalid cache message when reading
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Fri, 28 Dec 2012 00:13:32 +0100
changeset 18166 3a2e810dd3d8
parent 18165 0f5a0a2073a8
child 18167 59ac9a551bf4
branchmap: improve invalid cache message when reading This factors out the generation of the message. This helps future error reporting when reading cache for filtered repository.
mercurial/branchmap.py
tests/test-acl.t
tests/test-newbranch.t
--- a/mercurial/branchmap.py	Mon Dec 31 17:46:22 2012 -0600
+++ b/mercurial/branchmap.py	Fri Dec 28 00:13:32 2012 +0100
@@ -22,21 +22,20 @@
         partial = branchcache(tipnode=last, tiprev=lrev)
         if not partial.validfor(repo):
             # invalidate the cache
-            raise ValueError('invalidating branch cache (tip differs)')
+            raise ValueError('tip differs')
         for l in lines:
             if not l:
                 continue
             node, label = l.split(" ", 1)
             label = encoding.tolocal(label.strip())
             if not node in repo:
-                raise ValueError('invalidating branch cache because node '+
-                                 '%s does not exist' % node)
+                raise ValueError('node %s does not exist' % node)
             partial.setdefault(label, []).append(bin(node))
     except KeyboardInterrupt:
         raise
     except Exception, inst:
         if repo.ui.debugflag:
-            repo.ui.warn(str(inst), '\n')
+            repo.ui.warn(('invalid branchheads cache: %s\n') % inst)
         partial = branchcache()
     return partial
 
--- a/tests/test-acl.t	Mon Dec 31 17:46:22 2012 -0600
+++ b/tests/test-acl.t	Fri Dec 28 00:13:32 2012 +0100
@@ -140,7 +140,7 @@
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalidating branch cache (tip differs)
+  invalid branchheads cache: tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
@@ -202,7 +202,7 @@
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalidating branch cache (tip differs)
+  invalid branchheads cache: tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
@@ -274,7 +274,7 @@
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalidating branch cache (tip differs)
+  invalid branchheads cache: tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
@@ -773,7 +773,7 @@
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalidating branch cache (tip differs)
+  invalid branchheads cache: tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
@@ -1091,7 +1091,7 @@
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalidating branch cache (tip differs)
+  invalid branchheads cache: tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
@@ -1167,7 +1167,7 @@
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalidating branch cache (tip differs)
+  invalid branchheads cache: tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
@@ -1319,7 +1319,7 @@
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalidating branch cache (tip differs)
+  invalid branchheads cache: tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
@@ -1517,7 +1517,7 @@
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalidating branch cache (tip differs)
+  invalid branchheads cache: tip differs
   listing keys for "bookmarks"
   4 changesets found
   list of changesets:
@@ -1829,7 +1829,7 @@
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalidating branch cache (tip differs)
+  invalid branchheads cache: tip differs
   listing keys for "bookmarks"
   4 changesets found
   list of changesets:
@@ -1917,7 +1917,7 @@
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalidating branch cache (tip differs)
+  invalid branchheads cache: tip differs
   listing keys for "bookmarks"
   4 changesets found
   list of changesets:
@@ -2073,7 +2073,7 @@
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalidating branch cache (tip differs)
+  invalid branchheads cache: tip differs
   listing keys for "bookmarks"
   4 changesets found
   list of changesets:
--- a/tests/test-newbranch.t	Mon Dec 31 17:46:22 2012 -0600
+++ b/tests/test-newbranch.t	Fri Dec 28 00:13:32 2012 +0100
@@ -126,7 +126,7 @@
   $ cp .hg/bc-invalid $branchcache
 
   $ hg --debug log -r foo
-  invalidating branch cache (tip differs)
+  invalid branchheads cache: tip differs
   changeset:   4:adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6
   branch:      foo
   tag:         tip