Mercurial > public > mercurial-scm > hg
comparison mercurial/branchmap.py @ 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 | 75688a6f0bca |
children | 328739ea70c3 |
comparison
equal
deleted
inserted
replaced
25265:e16456831516 | 25266:38117278f295 |
---|---|
339 """Return branch name and close flag for rev, using and updating | 339 """Return branch name and close flag for rev, using and updating |
340 persistent cache.""" | 340 persistent cache.""" |
341 changelog = self._repo.changelog | 341 changelog = self._repo.changelog |
342 rbcrevidx = rev * _rbcrecsize | 342 rbcrevidx = rev * _rbcrecsize |
343 | 343 |
344 # avoid negative index, changelog.read(nullrev) is fast without cache | |
345 if rev == nullrev: | |
346 return changelog.branchinfo(rev) | |
347 | |
344 # if requested rev is missing, add and populate all missing revs | 348 # if requested rev is missing, add and populate all missing revs |
345 if len(self._rbcrevs) < rbcrevidx + _rbcrecsize: | 349 if len(self._rbcrevs) < rbcrevidx + _rbcrecsize: |
346 self._rbcrevs.extend('\0' * (len(changelog) * _rbcrecsize - | 350 self._rbcrevs.extend('\0' * (len(changelog) * _rbcrecsize - |
347 len(self._rbcrevs))) | 351 len(self._rbcrevs))) |
348 | 352 |