[PATCH STABLE] revbranchcache: special case nullrev
yuya at tcha.org
Sat May 23 00:59:15 CDT 2015
On Fri, 22 May 2015 21:59:30 -0700, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham at fb.com>
> # Date 1432357020 25200
> # Fri May 22 21:57:00 2015 -0700
> # Node ID 912ff2370836f46461218a68212c3c253d2bc5c7
> # Parent f2b98dacb37ddd6713b11a1a871fcdbbc5fd8bb2
> revbranchcache: special case nullrev
> hg log -r 'branch(.)' was causing a stack trace if the user was on the nullrev
> because it tried to access position -1 in the rev branch cache. This patch
> special cases the nullrev to avoid the cache.
> diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
> --- a/mercurial/branchmap.py
> +++ b/mercurial/branchmap.py
> @@ -338,6 +338,9 @@ class revbranchcache(object):
> def branchinfo(self, rev):
> """Return branch name and close flag for rev, using and updating
> persistent cache."""
> + if rev == nullrev:
> + return self._branchinfo(rev)
_branchinfo() calls _setcachedata() with negative rev, which is probably wrong.
I have a patch that will do "return changelog.branchinfo(rev)" instead, and
another patch for "children(branch(null))" issue.
More information about the Mercurial-devel