Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 12337:6a6149487817
bundle: encapsulate all bundle streams in unbundle class
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 20 Sep 2010 14:32:21 -0500 |
parents | e21fe9c5fb25 |
children | 01b6f058021b |
comparison
equal
deleted
inserted
replaced
12336:9d234f7d8a77 | 12337:6a6149487817 |
---|---|
1541 self.ui.progress(_('bundling files'), None) | 1541 self.ui.progress(_('bundling files'), None) |
1542 | 1542 |
1543 if msng_cl_lst: | 1543 if msng_cl_lst: |
1544 self.hook('outgoing', node=hex(msng_cl_lst[0]), source=source) | 1544 self.hook('outgoing', node=hex(msng_cl_lst[0]), source=source) |
1545 | 1545 |
1546 return util.chunkbuffer(gengroup()) | 1546 return changegroup.unbundle10(util.chunkbuffer(gengroup()), 'UN') |
1547 | 1547 |
1548 def changegroup(self, basenodes, source): | 1548 def changegroup(self, basenodes, source): |
1549 # to avoid a race we use changegroupsubset() (issue1320) | 1549 # to avoid a race we use changegroupsubset() (issue1320) |
1550 return self.changegroupsubset(basenodes, self.heads(), source) | 1550 return self.changegroupsubset(basenodes, self.heads(), source) |
1551 | 1551 |
1619 yield changegroup.closechunk() | 1619 yield changegroup.closechunk() |
1620 | 1620 |
1621 if nodes: | 1621 if nodes: |
1622 self.hook('outgoing', node=hex(nodes[0]), source=source) | 1622 self.hook('outgoing', node=hex(nodes[0]), source=source) |
1623 | 1623 |
1624 return util.chunkbuffer(gengroup()) | 1624 return changegroup.unbundle10(util.chunkbuffer(gengroup()), 'UN') |
1625 | 1625 |
1626 def addchangegroup(self, source, srctype, url, emptyok=False, lock=None): | 1626 def addchangegroup(self, source, srctype, url, emptyok=False, lock=None): |
1627 """Add the changegroup returned by source.read() to this repo. | 1627 """Add the changegroup returned by source.read() to this repo. |
1628 srctype is a string like 'push', 'pull', or 'unbundle'. url is | 1628 srctype is a string like 'push', 'pull', or 'unbundle'. url is |
1629 the URL of the repo where this changegroup is coming from. | 1629 the URL of the repo where this changegroup is coming from. |
1641 def revmap(x): | 1641 def revmap(x): |
1642 return cl.rev(x) | 1642 return cl.rev(x) |
1643 | 1643 |
1644 if not source: | 1644 if not source: |
1645 return 0 | 1645 return 0 |
1646 | |
1647 if not hasattr(source, 'chunk'): | |
1648 source = changegroup.unbundle10(source, 'UN') | |
1649 | 1646 |
1650 self.hook('prechangegroup', throw=True, source=srctype, url=url) | 1647 self.hook('prechangegroup', throw=True, source=srctype, url=url) |
1651 | 1648 |
1652 changesets = files = revisions = 0 | 1649 changesets = files = revisions = 0 |
1653 efiles = set() | 1650 efiles = set() |