Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revlog.py @ 1458:1033892bbb87
This changes the revlog.group and re-implements the localrepo.changeroup
function in terms of it.
revlog.group now takes a list of nodes, and some callback functions
instead of a linkmap.
author | Eric Hopper <hopper@omnifarious.org> |
---|---|
date | Fri, 07 Oct 2005 10:57:11 -0700 |
parents | 518da3c3b6ce |
children | 106fdec8e1fb |
line wrap: on
line diff
--- a/mercurial/revlog.py Fri Oct 07 10:48:27 2005 -0700 +++ b/mercurial/revlog.py Fri Oct 07 10:57:11 2005 -0700 @@ -622,7 +622,7 @@ #print "next x" gx = x.next() - def group(self, linkmap): + def group(self, nodelist, lookup, infocollect = None): """calculate a delta group Given a list of changeset revs, return a set of deltas and @@ -631,14 +631,8 @@ have this parent as it has all history before these changesets. parent is parent[0] """ - revs = [] - needed = {} - - # find file nodes/revs that match changeset revs - for i in xrange(0, self.count()): - if self.index[i][3] in linkmap: - revs.append(i) - needed[i] = 1 + revs = [self.rev(n) for n in nodelist] + needed = dict.fromkeys(revs, 1) # if we don't have any revisions touched by these changesets, bail if not revs: @@ -706,6 +700,9 @@ a, b = revs[d], revs[d + 1] n = self.node(b) + if infocollect is not None: + infocollect(n) + # do we need to construct a new delta? if a + 1 != b or self.base(b) == b: if a >= 0: @@ -727,7 +724,7 @@ d = chunks[b] p = self.parents(n) - meta = n + p[0] + p[1] + linkmap[self.linkrev(n)] + meta = n + p[0] + p[1] + lookup(n) l = struct.pack(">l", len(meta) + len(d) + 4) yield l yield meta