Patchwork [02,of,10,V2] branchmap: improve invalid cache message when reading

login
register
mail settings
Submitter Pierre-Yves David
Date Dec. 28, 2012, 12:56 a.m.
Message ID <6beb15cc7bca594bd301.1356656177@yamac.lan>
Download mbox | patch
Permalink /patch/307/
State Accepted
Commit 3a2e810dd3d85e18d214598c6f41d54fe3529ee7
Headers show

Comments

Pierre-Yves David - Dec. 28, 2012, 12:56 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1356650012 -3600
# Node ID 6beb15cc7bca594bd301779954f1fdce593c45ab
# Parent  c5c054b883f2e670c5e7c68fe54627d5d7d21486
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.

Patch

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -20,25 +20,24 @@  def read(repo):
         last, lrev = lines.pop(0).split(" ", 1)
         last, lrev = bin(last), int(lrev)
         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
 
 
 
diff --git a/tests/test-acl.t b/tests/test-acl.t
--- a/tests/test-acl.t
+++ b/tests/test-acl.t
@@ -138,11 +138,11 @@  Extension disabled for lack of acl.sourc
   """
   pushing to ../b
   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:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
@@ -200,11 +200,11 @@  No [acl.allow]/[acl.deny]
   """
   pushing to ../b
   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:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
@@ -272,11 +272,11 @@  Empty [acl.allow]
   """
   pushing to ../b
   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:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
@@ -771,11 +771,11 @@  wilma can change files with a .txt exten
   """
   pushing to ../b
   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:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
@@ -1089,11 +1089,11 @@  fred is always allowed
   """
   pushing to ../b
   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:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
@@ -1165,11 +1165,11 @@  no one is allowed inside foo/Bar/
   """
   pushing to ../b
   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:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
@@ -1317,11 +1317,11 @@  OS-level groups
   """
   pushing to ../b
   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:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
@@ -1515,11 +1515,11 @@  Branch acl deny test
   """
   pushing to ../b
   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:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
@@ -1827,11 +1827,11 @@  push foobar into the remote
   """
   pushing to ../b
   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:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
@@ -1915,11 +1915,11 @@  Branch acl conflicting deny
   """
   pushing to ../b
   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:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
@@ -2071,11 +2071,11 @@  Non-astro users must be denied
   """
   pushing to ../b
   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:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
diff --git a/tests/test-newbranch.t b/tests/test-newbranch.t
--- a/tests/test-newbranch.t
+++ b/tests/test-newbranch.t
@@ -124,11 +124,11 @@  Test for invalid branch cache:
   summary:     modify a branch
   
   $ 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
   phase:       draft
   parent:      1:6c0e42da283a56b5edc5b4fadb491365ec7f5fa8