diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -772,7 +772,8 @@ ellipsis=True, ) -def deltagroup(repo, revs, store, ischangelog, lookup, forcedeltaparentprev, +def deltagroup(repo, store, nodes, ischangelog, lookup, forcedeltaparentprev, + allowreorder, units=None, ellipses=False, clrevtolocalrev=None, fullclnodes=None, precomputedellipsis=None): @@ -783,7 +784,7 @@ If units is not None, progress detail will be generated, units specifies the type of revlog that is touched (changelog, manifest, etc.). """ - if not revs: + if not nodes: return # We perform two passes over the revisions whose data we will emit. @@ -798,6 +799,17 @@ cl = repo.changelog + if ischangelog: + # Changelog doesn't benefit from reordering revisions. So send + # out revisions in store order. + # TODO the API would be cleaner if this were controlled by the + # store producing the deltas. + revs = sorted(cl.rev(n) for n in nodes) + elif ellipses: + revs = _sortnodesellipsis(store, nodes, cl, lookup) + else: + revs = _sortnodesnormal(store, nodes, allowreorder) + # In the first pass, collect info about the deltas we'll be # generating. requests = [] @@ -1100,10 +1112,6 @@ return x - # Changelog doesn't benefit from reordering revisions. So send out - # revisions in store order. - revs = sorted(cl.rev(n) for n in nodes) - state = { 'clrevorder': clrevorder, 'mfs': mfs, @@ -1112,8 +1120,10 @@ } gen = deltagroup( - self._repo, revs, cl, True, lookupcl, + self._repo, cl, nodes, True, lookupcl, self._forcedeltaparentprev, + # Reorder settings are currently ignored for changelog. + True, ellipses=self._ellipses, units=_('changesets'), clrevtolocalrev={}, @@ -1130,7 +1140,6 @@ change what is sent based in pulls vs pushes, etc. """ repo = self._repo - cl = repo.changelog mfl = repo.manifestlog dirlog = mfl._revlog.dirlog tmfnodes = {'': mfs} @@ -1193,16 +1202,9 @@ lookupfn = makelookupmflinknode(dir, nodes) - if self._ellipses: - revs = _sortnodesellipsis(store, prunednodes, cl, - lookupfn) - else: - revs = _sortnodesnormal(store, prunednodes, - self._reorder) - deltas = deltagroup( - self._repo, revs, store, False, lookupfn, - self._forcedeltaparentprev, + self._repo, store, prunednodes, False, lookupfn, + self._forcedeltaparentprev, self._reorder, ellipses=self._ellipses, units=_('manifests'), clrevtolocalrev=clrevtolocalrev, @@ -1261,7 +1263,6 @@ linknodes = normallinknodes repo = self._repo - cl = repo.changelog progress = repo.ui.makeprogress(_('bundling'), unit=_('files'), total=len(changedfiles)) for i, fname in enumerate(sorted(changedfiles)): @@ -1285,18 +1286,11 @@ if not filenodes: continue - if self._ellipses: - revs = _sortnodesellipsis(filerevlog, filenodes, - cl, lookupfilelog) - else: - revs = _sortnodesnormal(filerevlog, filenodes, - self._reorder) - progress.update(i + 1, item=fname) deltas = deltagroup( - self._repo, revs, filerevlog, False, lookupfilelog, - self._forcedeltaparentprev, + self._repo, filerevlog, filenodes, False, lookupfilelog, + self._forcedeltaparentprev, self._reorder, ellipses=self._ellipses, clrevtolocalrev=clrevtolocalrev, fullclnodes=self._fullclnodes,