Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 9437:1c4e4004f3a6
Improve some docstrings relating to changegroups and prepush().
author | Greg Ward <greg-hg@gerg.ca> |
---|---|
date | Tue, 08 Sep 2009 17:58:59 -0400 |
parents | 6cfea6e4c892 |
children | 4c041f1ee1b4 02c43e8e0835 |
comparison
equal
deleted
inserted
replaced
9436:96379c93ba6f | 9437:1c4e4004f3a6 |
---|---|
1455 if remote.capable('unbundle'): | 1455 if remote.capable('unbundle'): |
1456 return self.push_unbundle(remote, force, revs) | 1456 return self.push_unbundle(remote, force, revs) |
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) |
1463 | 1469 |
1464 update, updated_heads = self.findoutgoing(remote, common, remote_heads) | 1470 update, updated_heads = self.findoutgoing(remote, common, remote_heads) |
1599 self.ui.debug(_("list of changesets:\n")) | 1605 self.ui.debug(_("list of changesets:\n")) |
1600 for node in nodes: | 1606 for node in nodes: |
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 """This function generates a changegroup consisting of all the nodes | 1610 """Compute a changegroup consisting of all the nodes that are |
1605 that are descendents of any of the bases, and ancestors of any of | 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 |
1610 is non-trivial. | 1617 is non-trivial. |
1611 | 1618 |
1900 def changegroup(self, basenodes, source): | 1907 def changegroup(self, basenodes, source): |
1901 # to avoid a race we use changegroupsubset() (issue1320) | 1908 # to avoid a race we use changegroupsubset() (issue1320) |
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 """Generate a changegroup of all nodes that we have that a recipient | 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. |
1910 | 1918 |
1911 common is the set of common nodes between remote and self""" | 1919 common is the set of common nodes between remote and self""" |
1935 def lookuprevlink(n): | 1943 def lookuprevlink(n): |
1936 return cl.node(revlog.linkrev(revlog.rev(n))) | 1944 return cl.node(revlog.linkrev(revlog.rev(n))) |
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 |
1943 for chnk in cl.group(nodes, identity, | 1952 for chnk in cl.group(nodes, identity, |
1944 changed_file_collector(changedfiles)): | 1953 changed_file_collector(changedfiles)): |