Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revset.py @ 24374:77fd1fb538cd
revbranchcache: store repo on the object
Previously we would instantiate the revbranchcache with a repo object, use it
briefly, then require it be passed in every time we wanted to fetch any
information. This seems unnecessary since it's obviously specific to that repo
(since it was constructed with it).
This patch stores the repo on the revbranchcache object, and removes the repo
parameter from the various functions on that class. This has the other nice
benefit of removing the double-revbranchcache-read that existed before (it was
read once for the branch revset, and once for the repo.revbranchcache).
author | Durham Goode <durham@fb.com> |
---|---|
date | Tue, 10 Feb 2015 19:57:51 -0800 |
parents | e8ea31131705 |
children | 0e41f110e69e |
line wrap: on
line diff
--- a/mercurial/revset.py Tue Feb 10 19:53:48 2015 -0800 +++ b/mercurial/revset.py Tue Feb 10 19:57:51 2015 -0800 @@ -528,10 +528,7 @@ a regular expression. To match a branch that actually starts with `re:`, use the prefix `literal:`. """ - import branchmap - urepo = repo.unfiltered() - ucl = urepo.changelog - getbi = branchmap.revbranchcache(urepo, readonly=True).branchinfo + getbi = repo.revbranchcache().branchinfo try: b = getstring(x, '') @@ -544,16 +541,16 @@ # note: falls through to the revspec case if no branch with # this name exists if pattern in repo.branchmap(): - return subset.filter(lambda r: matcher(getbi(ucl, r)[0])) + return subset.filter(lambda r: matcher(getbi(r)[0])) else: - return subset.filter(lambda r: matcher(getbi(ucl, r)[0])) + return subset.filter(lambda r: matcher(getbi(r)[0])) s = getset(repo, fullreposet(repo), x) b = set() for r in s: - b.add(getbi(ucl, r)[0]) + b.add(getbi(r)[0]) c = s.__contains__ - return subset.filter(lambda r: c(r) or getbi(ucl, r)[0] in b) + return subset.filter(lambda r: c(r) or getbi(r)[0] in b) def bumped(repo, subset, x): """``bumped()``