# HG changeset patch # User Mads Kiilerich # Date 1358365294 -3600 # Node ID 8b0f0dd56cecb552c839154d92f8a3db3a1d7c9a # Parent de7dac2a58e8372e3d3c16e678ed99a3d0eae0a7 bundlerepo: improve performance for bundle() revset expression Create the set of revision numbers directly instead of creating a list of nodes first. diff -r de7dac2a58e8 -r 8b0f0dd56cec mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py Wed Jan 16 20:41:32 2013 +0100 +++ b/mercurial/bundlerepo.py Wed Jan 16 20:41:34 2013 +0100 @@ -25,8 +25,7 @@ # (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 @@ 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 @@ 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 @@ self.basemap[n] = deltabase self.index.insert(-1, e) self.nodemap[node] = n + self.bundlerevs.add(n) chain = node n += 1 diff -r de7dac2a58e8 -r 8b0f0dd56cec mercurial/revset.py --- a/mercurial/revset.py Wed Jan 16 20:41:32 2013 +0100 +++ b/mercurial/revset.py Wed Jan 16 20:41:34 2013 +0100 @@ -450,11 +450,10 @@ 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