mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
bundlerepo: improve performance for bundle() revset expression
Create the set of revision numbers directly instead of creating a list of nodes first.
This commit is contained in:
parent
2539797b50
commit
7bc546e4e0
@ -25,8 +25,7 @@ class bundlerevlog(revlog.revlog):
|
||||
# (start).
|
||||
#
|
||||
# basemap is indexed with revisions coming from the bundle, and it
|
||||
# maps to the corresponding node that is the base of the corresponding
|
||||
# delta.
|
||||
# maps to the node that is the base of the corresponding delta.
|
||||
#
|
||||
# To differentiate a rev in the bundle from a rev in the revlog, we
|
||||
# check revision against basemap.
|
||||
@ -37,7 +36,7 @@ class bundlerevlog(revlog.revlog):
|
||||
n = len(self)
|
||||
self.disktiprev = n - 1
|
||||
chain = None
|
||||
self.bundlenodes = []
|
||||
self.bundlerevs = set() # used by 'bundle()' revset expression
|
||||
while True:
|
||||
chunkdata = bundle.deltachunk(chain)
|
||||
if not chunkdata:
|
||||
@ -53,10 +52,10 @@ class bundlerevlog(revlog.revlog):
|
||||
start = bundle.tell() - size
|
||||
|
||||
link = linkmapper(cs)
|
||||
self.bundlenodes.append(node)
|
||||
if node in self.nodemap:
|
||||
# this can happen if two branches make the same change
|
||||
chain = node
|
||||
self.bundlerevs.add(self.nodemap[node])
|
||||
continue
|
||||
|
||||
for p in (p1, p2):
|
||||
@ -69,6 +68,7 @@ class bundlerevlog(revlog.revlog):
|
||||
self.basemap[n] = deltabase
|
||||
self.index.insert(-1, e)
|
||||
self.nodemap[node] = n
|
||||
self.bundlerevs.add(n)
|
||||
chain = node
|
||||
n += 1
|
||||
|
||||
|
@ -450,11 +450,10 @@ def bundle(repo, subset, x):
|
||||
Bundle must be specified by the -R option."""
|
||||
|
||||
try:
|
||||
bundlenodes = repo.changelog.bundlenodes
|
||||
bundlerevs = repo.changelog.bundlerevs
|
||||
except AttributeError:
|
||||
raise util.Abort(_("no bundle provided - specify with -R"))
|
||||
revs = set(repo[n].rev() for n in bundlenodes)
|
||||
return [r for r in subset if r in revs]
|
||||
return [r for r in subset if r in bundlerevs]
|
||||
|
||||
def checkstatus(repo, subset, pat, field):
|
||||
m = None
|
||||
|
Loading…
Reference in New Issue
Block a user