[PATCH] branchmap: display filtername when `updatebranch` fails to do its jobs

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Jan 18 19:30:19 CST 2013


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1358558996 -3600
# Node ID e2da07f2d2f450ee383a26d7d1624581a490a72b
# Parent  64848f7fb7642bd1554c97049cc08d049b02941c
branchmap: display filtername when `updatebranch` fails to do its jobs

We have a very handy assert at the ends of `branchmap.updatecache` that check
the resulting branchmap is actually valid.

I know we do not like assert in mercurial but this one is very handy for
debugging. There is really not reason for `branchmap.updatecache` to have this
kind of issue but this happened and handful of time during the development of
this or introduction of other related feature. I advice to keep it around until
we are a bit more confident with the new code.

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -77,11 +77,11 @@ def updatecache(repo):
                 revs.extend(r for  r in extrarevs if r <= partial.tiprev)
     revs.extend(cl.revs(start=partial.tiprev + 1))
     if revs:
         partial.update(repo, revs)
         partial.write(repo)
-    assert partial.validfor(repo)
+    assert partial.validfor(repo), filtername
     repo._branchcaches[repo.filtername] = partial
 
 class branchcache(dict):
     """A dict like object that hold branches heads cache"""
 


More information about the Mercurial-devel mailing list