[PATCH 1 of 9] branchmap: improve invalid cache message when reading
Kevin Bullock
kbullock+mercurial at ringworld.org
Thu Dec 27 16:43:44 UTC 2012
On Dec 26, 2012, at 2:32 PM, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at logilab.fr>
> # Date 1356273303 -3600
> # Node ID 2745467aa74ecaeb7c4c244c65a8e05fb2fc10a9
> # Parent 7f5a0eba37683f04bfb2beab62edfd4732b88ea3
> branchmap: improve invalid cache message when reading
>
> This factorise the generation of the message. This helps future error reporting
factors out
> when reading cache for filtered repository.
>
> 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)
1. Choose either this colon, or parentheses around the message on inst, but not both.
2. Shouldn't we be using ui.debug() here?
3. Am I recalling correctly that we don't translate debug messages? If so, the inner parentheses are unnecessary. If not, you're missing an underscore before them.
pacem in terris / мир / शान्ति / سَلاَم / 平和
Kevin R. Bullock
More information about the Mercurial-devel
mailing list