Mercurial > hg
changeset 25266:38117278f295 stable
revbranchcache: return uncached branchinfo for nullrev (issue4683)
This fixes the crash caused by "branch(null)" revset. No cache should be
necessary for nullrev because changelog.branchinfo(nullrev) does not involve
IO operation.
Note that the problem of "branch(wdir())" isn't addressed by this patch.
"wdir()" will raise TypeError in many places because of None. This is the
reason why "wdir()" is still experimental.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 23 May 2015 11:14:00 +0900 |
parents | e16456831516 |
children | 69c5cab0b893 |
files | mercurial/branchmap.py tests/test-revset.t |
diffstat | 2 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/branchmap.py Sun May 24 10:29:33 2015 +0900 +++ b/mercurial/branchmap.py Sat May 23 11:14:00 2015 +0900 @@ -341,6 +341,10 @@ changelog = self._repo.changelog rbcrevidx = rev * _rbcrecsize + # avoid negative index, changelog.read(nullrev) is fast without cache + if rev == nullrev: + return changelog.branchinfo(rev) + # if requested rev is missing, add and populate all missing revs if len(self._rbcrevs) < rbcrevidx + _rbcrecsize: self._rbcrevs.extend('\0' * (len(changelog) * _rbcrecsize -
--- a/tests/test-revset.t Sun May 24 10:29:33 2015 +0900 +++ b/tests/test-revset.t Sat May 23 11:14:00 2015 +0900 @@ -1602,6 +1602,14 @@ $ echo default5 >> a $ hg ci -m5 +"null" revision belongs to "default" branch (issue4683) + + $ log 'branch(null)' + 0 + 1 + 4 + 5 + "null" revision belongs to "default" branch, but it shouldn't appear in set unless explicitly specified (issue4682)