Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revlog.py @ 13781:66c54d2ebe72
changegroup: drop unused fullrev
This is unfinished and unused and complicates expanding the wire protocol.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 24 Mar 2011 17:16:30 -0500 |
parents | 10aea25fb519 |
children | 9131724c3f4b |
comparison
equal
deleted
inserted
replaced
13780:bc7b5d1c1999 | 13781:66c54d2ebe72 |
---|---|
1056 | 1056 |
1057 if type(text) == str: # only accept immutable objects | 1057 if type(text) == str: # only accept immutable objects |
1058 self._cache = (node, curr, text) | 1058 self._cache = (node, curr, text) |
1059 return node | 1059 return node |
1060 | 1060 |
1061 def group(self, nodelist, lookup, infocollect=None, fullrev=False): | 1061 def group(self, nodelist, lookup, infocollect=None): |
1062 """Calculate a delta group, yielding a sequence of changegroup chunks | 1062 """Calculate a delta group, yielding a sequence of changegroup chunks |
1063 (strings). | 1063 (strings). |
1064 | 1064 |
1065 Given a list of changeset revs, return a set of deltas and | 1065 Given a list of changeset revs, return a set of deltas and |
1066 metadata corresponding to nodes. The first delta is | 1066 metadata corresponding to nodes. The first delta is |
1067 first parent(nodelist[0]) -> nodelist[0], the receiver is | 1067 first parent(nodelist[0]) -> nodelist[0], the receiver is |
1068 guaranteed to have this parent as it has all history before | 1068 guaranteed to have this parent as it has all history before |
1069 these changesets. In the case firstparent is nullrev the | 1069 these changesets. In the case firstparent is nullrev the |
1070 changegroup starts with a full revision. | 1070 changegroup starts with a full revision. |
1071 fullrev forces the insertion of the full revision, necessary | |
1072 in the case of shallow clones where the first parent might | |
1073 not exist at the reciever. | |
1074 """ | 1071 """ |
1075 | 1072 |
1076 revs = [self.rev(n) for n in nodelist] | 1073 revs = [self.rev(n) for n in nodelist] |
1077 | 1074 |
1078 # if we don't have any revisions touched by these changesets, bail | 1075 # if we don't have any revisions touched by these changesets, bail |
1081 return | 1078 return |
1082 | 1079 |
1083 # add the parent of the first rev | 1080 # add the parent of the first rev |
1084 p = self.parentrevs(revs[0])[0] | 1081 p = self.parentrevs(revs[0])[0] |
1085 revs.insert(0, p) | 1082 revs.insert(0, p) |
1086 if p == nullrev: | |
1087 fullrev = True | |
1088 | 1083 |
1089 # build deltas | 1084 # build deltas |
1090 for r in xrange(len(revs) - 1): | 1085 for r in xrange(len(revs) - 1): |
1091 a, b = revs[r], revs[r + 1] | 1086 a, b = revs[r], revs[r + 1] |
1092 nb = self.node(b) | 1087 nb = self.node(b) |
1094 if infocollect is not None: | 1089 if infocollect is not None: |
1095 infocollect(nb) | 1090 infocollect(nb) |
1096 | 1091 |
1097 p = self.parents(nb) | 1092 p = self.parents(nb) |
1098 meta = nb + p[0] + p[1] + lookup(nb) | 1093 meta = nb + p[0] + p[1] + lookup(nb) |
1099 if fullrev: | 1094 if a == nullrev: |
1100 d = self.revision(nb) | 1095 d = self.revision(nb) |
1101 meta += mdiff.trivialdiffheader(len(d)) | 1096 meta += mdiff.trivialdiffheader(len(d)) |
1102 fullrev = False | |
1103 else: | 1097 else: |
1104 d = self.revdiff(a, b) | 1098 d = self.revdiff(a, b) |
1105 yield changegroup.chunkheader(len(meta) + len(d)) | 1099 yield changegroup.chunkheader(len(meta) + len(d)) |
1106 yield meta | 1100 yield meta |
1107 yield d | 1101 yield d |