def group(self, nodelist, lookup, infocollect=None, fullrev=False): """Calculate a delta group, yielding a sequence of changegroup chunks (strings). Given a list of changeset revs, return a set of deltas and metadata corresponding to nodes. The first delta is first parent(nodelist[0]) -> nodelist[0], the receiver is guaranteed to have this parent as it has all history before these changesets. In the case firstparent is nullrev the changegroup starts with a full revision. fullrev forces the insertion of the full revision, necessary in the case of shallow clones where the first parent might not exist at the reciever. """ revs = [self.rev(n) for n in nodelist] # if we don't have any revisions touched by these changesets, bail if not revs: yield changegroup.closechunk() return # add the parent of the first rev p = self.parentrevs(revs[0])[0] revs.insert(0, p) if p == nullrev: fullrev = True # build deltas for d in xrange(len(revs) - 1): a, b = revs[d], revs[d + 1] nb = self.node(b) if infocollect is not None: infocollect(nb) p = self.parents(nb) meta = nb + p[0] + p[1] + lookup(nb) if fullrev: d = self.revision(nb) meta += mdiff.trivialdiffheader(len(d)) fullrev = False else: d = self.revdiff(a, b) yield changegroup.chunkheader(len(meta) + len(d)) yield meta yield d yield changegroup.closechunk()
def group(self, nodelist, lookup, infocollect=None): """Calculate a delta group, yielding a sequence of changegroup chunks (strings). Given a list of changeset revs, return a set of deltas and metadata corresponding to nodes. the first delta is parent(nodes[0]) -> nodes[0] the receiver is guaranteed to have this parent as it has all history before these changesets. parent is parent[0] """ revs = [self.rev(n) for n in nodelist] # if we don't have any revisions touched by these changesets, bail if not revs: yield changegroup.closechunk() return # add the parent of the first rev p = self.parentrevs(revs[0])[0] revs.insert(0, p) # build deltas for d in xrange(len(revs) - 1): a, b = revs[d], revs[d + 1] nb = self.node(b) if infocollect is not None: infocollect(nb) p = self.parents(nb) meta = nb + p[0] + p[1] + lookup(nb) if a == -1: d = self.revision(nb) meta += mdiff.trivialdiffheader(len(d)) else: d = self.revdiff(a, b) yield changegroup.chunkheader(len(meta) + len(d)) yield meta if len(d) > 2**20: pos = 0 while pos < len(d): pos2 = pos + 2 ** 18 yield d[pos:pos2] pos = pos2 else: yield d yield changegroup.closechunk()
def group(self, nodelist, lookup, infocollect=None): """Calculate a delta group, yielding a sequence of changegroup chunks (strings). Given a list of changeset revs, return a set of deltas and metadata corresponding to nodes. the first delta is parent(nodes[0]) -> nodes[0] the receiver is guaranteed to have this parent as it has all history before these changesets. parent is parent[0] """ revs = [self.rev(n) for n in nodelist] # if we don't have any revisions touched by these changesets, bail if not revs: yield changegroup.closechunk() return # add the parent of the first rev p = self.parentrevs(revs[0])[0] revs.insert(0, p) # build deltas for d in xrange(len(revs) - 1): a, b = revs[d], revs[d + 1] nb = self.node(b) if infocollect is not None: infocollect(nb) p = self.parents(nb) meta = nb + p[0] + p[1] + lookup(nb) if a == -1: d = self.revision(nb) meta += mdiff.trivialdiffheader(len(d)) else: d = self.revdiff(a, b) yield changegroup.chunkheader(len(meta) + len(d)) yield meta if len(d) > 2**20: pos = 0 while pos < len(d): pos2 = pos + 2**18 yield d[pos:pos2] pos = pos2 else: yield d yield changegroup.closechunk()