Show More
@@ -10,7 +10,7 b' import util' | |||||
10 | import struct, os, bz2, zlib, tempfile |
|
10 | import struct, os, bz2, zlib, tempfile | |
11 |
|
11 | |||
12 | def getchunk(source): |
|
12 | def getchunk(source): | |
13 |
""" |
|
13 | """return the next chunk from changegroup 'source' as a string""" | |
14 | d = source.read(4) |
|
14 | d = source.read(4) | |
15 | if not d: |
|
15 | if not d: | |
16 | return "" |
|
16 | return "" | |
@@ -25,7 +25,8 b' def getchunk(source):' | |||||
25 | return d |
|
25 | return d | |
26 |
|
26 | |||
27 | def chunkiter(source): |
|
27 | def chunkiter(source): | |
28 |
"""iterate through the chunks in source |
|
28 | """iterate through the chunks in source, yielding a sequence of chunks | |
|
29 | (strings)""" | |||
29 | while 1: |
|
30 | while 1: | |
30 | c = getchunk(source) |
|
31 | c = getchunk(source) | |
31 | if not c: |
|
32 | if not c: | |
@@ -33,10 +34,11 b' def chunkiter(source):' | |||||
33 | yield c |
|
34 | yield c | |
34 |
|
35 | |||
35 | def chunkheader(length): |
|
36 | def chunkheader(length): | |
36 |
""" |
|
37 | """return a changegroup chunk header (string)""" | |
37 | return struct.pack(">l", length + 4) |
|
38 | return struct.pack(">l", length + 4) | |
38 |
|
39 | |||
39 | def closechunk(): |
|
40 | def closechunk(): | |
|
41 | """return a changegroup chunk header (string) for a zero-length chunk""" | |||
40 | return struct.pack(">l", 0) |
|
42 | return struct.pack(">l", 0) | |
41 |
|
43 | |||
42 | class nocompress(object): |
|
44 | class nocompress(object): |
@@ -1457,6 +1457,12 b' class localrepository(repo.repository):' | |||||
1457 | return self.push_addchangegroup(remote, force, revs) |
|
1457 | return self.push_addchangegroup(remote, force, revs) | |
1458 |
|
1458 | |||
1459 | def prepush(self, remote, force, revs): |
|
1459 | def prepush(self, remote, force, revs): | |
|
1460 | '''Analyze the local and remote repositories and determine which | |||
|
1461 | changesets need to be pushed to the remote. Return a tuple | |||
|
1462 | (changegroup, remoteheads). changegroup is a readable file-like | |||
|
1463 | object whose read() returns successive changegroup chunks ready to | |||
|
1464 | be sent over the wire. remoteheads is the list of remote heads. | |||
|
1465 | ''' | |||
1460 | common = {} |
|
1466 | common = {} | |
1461 | remote_heads = remote.heads() |
|
1467 | remote_heads = remote.heads() | |
1462 | inc = self.findincoming(remote, common, remote_heads, force=force) |
|
1468 | inc = self.findincoming(remote, common, remote_heads, force=force) | |
@@ -1601,9 +1607,10 b' class localrepository(repo.repository):' | |||||
1601 | self.ui.debug("%s\n" % hex(node)) |
|
1607 | self.ui.debug("%s\n" % hex(node)) | |
1602 |
|
1608 | |||
1603 | def changegroupsubset(self, bases, heads, source, extranodes=None): |
|
1609 | def changegroupsubset(self, bases, heads, source, extranodes=None): | |
1604 |
""" |
|
1610 | """Compute a changegroup consisting of all the nodes that are | |
1605 |
|
|
1611 | descendents of any of the bases and ancestors of any of the heads. | |
1606 | the heads. |
|
1612 | Return a chunkbuffer object whose read() method will return | |
|
1613 | successive changegroup chunks. | |||
1607 |
|
1614 | |||
1608 | It is fairly complex as determining which filenodes and which |
|
1615 | It is fairly complex as determining which filenodes and which | |
1609 | manifest nodes need to be included for the changeset to be complete |
|
1616 | manifest nodes need to be included for the changeset to be complete | |
@@ -1902,8 +1909,9 b' class localrepository(repo.repository):' | |||||
1902 | return self.changegroupsubset(basenodes, self.heads(), source) |
|
1909 | return self.changegroupsubset(basenodes, self.heads(), source) | |
1903 |
|
1910 | |||
1904 | def _changegroup(self, common, source): |
|
1911 | def _changegroup(self, common, source): | |
1905 |
""" |
|
1912 | """Compute the changegroup of all nodes that we have that a recipient | |
1906 | doesn't. |
|
1913 | doesn't. Return a chunkbuffer object whose read() method will return | |
|
1914 | successive changegroup chunks. | |||
1907 |
|
1915 | |||
1908 | This is much easier than the previous function as we can assume that |
|
1916 | This is much easier than the previous function as we can assume that | |
1909 | the recipient has any changenode we aren't sending them. |
|
1917 | the recipient has any changenode we aren't sending them. | |
@@ -1937,6 +1945,7 b' class localrepository(repo.repository):' | |||||
1937 | return lookuprevlink |
|
1945 | return lookuprevlink | |
1938 |
|
1946 | |||
1939 | def gengroup(): |
|
1947 | def gengroup(): | |
|
1948 | '''yield a sequence of changegroup chunks (strings)''' | |||
1940 | # construct a list of all changed files |
|
1949 | # construct a list of all changed files | |
1941 | changedfiles = set() |
|
1950 | changedfiles = set() | |
1942 |
|
1951 |
@@ -1128,7 +1128,8 b' class revlog(object):' | |||||
1128 | return self.node(c) |
|
1128 | return self.node(c) | |
1129 |
|
1129 | |||
1130 | def group(self, nodelist, lookup, infocollect=None): |
|
1130 | def group(self, nodelist, lookup, infocollect=None): | |
1131 | """calculate a delta group |
|
1131 | """Calculate a delta group, yielding a sequence of changegroup chunks | |
|
1132 | (strings). | |||
1132 |
|
1133 | |||
1133 | Given a list of changeset revs, return a set of deltas and |
|
1134 | Given a list of changeset revs, return a set of deltas and | |
1134 | metadata corresponding to nodes. the first delta is |
|
1135 | metadata corresponding to nodes. the first delta is |
General Comments 0
You need to be logged in to leave comments.
Login now