##// END OF EJS Templates
bundlerepo: improve performance for bundle() revset expression...
Mads Kiilerich -
r18411:8b0f0dd5 default
parent child Browse files
Show More
@@ -25,8 +25,7 b' class bundlerevlog(revlog.revlog):'
25 # (start).
25 # (start).
26 #
26 #
27 # basemap is indexed with revisions coming from the bundle, and it
27 # basemap is indexed with revisions coming from the bundle, and it
28 # maps to the corresponding node that is the base of the corresponding
28 # maps to the node that is the base of the corresponding delta.
29 # delta.
30 #
29 #
31 # To differentiate a rev in the bundle from a rev in the revlog, we
30 # To differentiate a rev in the bundle from a rev in the revlog, we
32 # check revision against basemap.
31 # check revision against basemap.
@@ -37,7 +36,7 b' class bundlerevlog(revlog.revlog):'
37 n = len(self)
36 n = len(self)
38 self.disktiprev = n - 1
37 self.disktiprev = n - 1
39 chain = None
38 chain = None
40 self.bundlenodes = []
39 self.bundlerevs = set() # used by 'bundle()' revset expression
41 while True:
40 while True:
42 chunkdata = bundle.deltachunk(chain)
41 chunkdata = bundle.deltachunk(chain)
43 if not chunkdata:
42 if not chunkdata:
@@ -53,10 +52,10 b' class bundlerevlog(revlog.revlog):'
53 start = bundle.tell() - size
52 start = bundle.tell() - size
54
53
55 link = linkmapper(cs)
54 link = linkmapper(cs)
56 self.bundlenodes.append(node)
57 if node in self.nodemap:
55 if node in self.nodemap:
58 # this can happen if two branches make the same change
56 # this can happen if two branches make the same change
59 chain = node
57 chain = node
58 self.bundlerevs.add(self.nodemap[node])
60 continue
59 continue
61
60
62 for p in (p1, p2):
61 for p in (p1, p2):
@@ -69,6 +68,7 b' class bundlerevlog(revlog.revlog):'
69 self.basemap[n] = deltabase
68 self.basemap[n] = deltabase
70 self.index.insert(-1, e)
69 self.index.insert(-1, e)
71 self.nodemap[node] = n
70 self.nodemap[node] = n
71 self.bundlerevs.add(n)
72 chain = node
72 chain = node
73 n += 1
73 n += 1
74
74
@@ -450,11 +450,10 b' def bundle(repo, subset, x):'
450 Bundle must be specified by the -R option."""
450 Bundle must be specified by the -R option."""
451
451
452 try:
452 try:
453 bundlenodes = repo.changelog.bundlenodes
453 bundlerevs = repo.changelog.bundlerevs
454 except AttributeError:
454 except AttributeError:
455 raise util.Abort(_("no bundle provided - specify with -R"))
455 raise util.Abort(_("no bundle provided - specify with -R"))
456 revs = set(repo[n].rev() for n in bundlenodes)
456 return [r for r in subset if r in bundlerevs]
457 return [r for r in subset if r in revs]
458
457
459 def checkstatus(repo, subset, pat, field):
458 def checkstatus(repo, subset, pat, field):
460 m = None
459 m = None
General Comments 0
You need to be logged in to leave comments. Login now