Patchwork branchmap: display filtername when `updatebranch` fails to do its jobs

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 19, 2013, 1:30 a.m.
Message ID <e2da07f2d2f450ee383a.1358559019@yamac.lan>
Download mbox | patch
Permalink /patch/685/
State Accepted
Commit d6b3b36f1db2e3861bed85fa4a443aa9ca288a9b
Headers show

Comments

Pierre-Yves David - Jan. 19, 2013, 1:30 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.
Matt Mackall - Jan. 19, 2013, 1:52 a.m.
On Sat, 2013-01-19 at 02:30 +0100, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
> # Date 1358558996 -3600
> # Node ID e2da07f2d2f450ee383a26d7d1624581a490a72b
> # Parent  64848f7fb7642bd1554c97049cc08d049b02941c
> branchmap: display filtername when `updatebranch` fails to do its jobs

I guess if we're going to have an assert, we might as well have a
verbose one. Queued for default, thanks.

Patch

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"""