Show More
@@ -117,8 +117,7 b' def writerevs(ui, r1, r2, order, tr):' | |||||
117 |
|
117 | |||
118 | try: |
|
118 | try: | |
119 | group = util.chunkbuffer(r1.group(order, lookup, progress)) |
|
119 | group = util.chunkbuffer(r1.group(order, lookup, progress)) | |
120 | chunkiter = changegroup.chunkiter(group) |
|
120 | r2.addgroup(group.chunks(), unlookup, tr) | |
121 | r2.addgroup(chunkiter, unlookup, tr) |
|
|||
122 | finally: |
|
121 | finally: | |
123 | ui.progress(_('writing'), None) |
|
122 | ui.progress(_('writing'), None) | |
124 |
|
123 |
@@ -33,7 +33,7 b' class bundlerevlog(revlog.revlog):' | |||||
33 | self.bundle = bundle |
|
33 | self.bundle = bundle | |
34 | self.basemap = {} |
|
34 | self.basemap = {} | |
35 | def chunkpositer(): |
|
35 | def chunkpositer(): | |
36 |
for chunk in |
|
36 | for chunk in bundle.chunks(): | |
37 | pos = bundle.tell() |
|
37 | pos = bundle.tell() | |
38 | yield chunk, pos - len(chunk) |
|
38 | yield chunk, pos - len(chunk) | |
39 | n = len(self) |
|
39 | n = len(self) | |
@@ -226,11 +226,11 b' class bundlerepository(localrepo.localre' | |||||
226 | if not self.bundlefilespos: |
|
226 | if not self.bundlefilespos: | |
227 | self.bundle.seek(self.filestart) |
|
227 | self.bundle.seek(self.filestart) | |
228 | while 1: |
|
228 | while 1: | |
229 |
chunk = |
|
229 | chunk = self.bundle.chunk() | |
230 | if not chunk: |
|
230 | if not chunk: | |
231 | break |
|
231 | break | |
232 | self.bundlefilespos[chunk] = self.bundle.tell() |
|
232 | self.bundlefilespos[chunk] = self.bundle.tell() | |
233 |
for c in |
|
233 | for c in self.bundle.chunks(): | |
234 | pass |
|
234 | pass | |
235 |
|
235 | |||
236 | if f[0] == '/': |
|
236 | if f[0] == '/': |
@@ -150,6 +150,10 b' class unbundle10(object):' | |||||
150 | return self._stream.seek(pos) |
|
150 | return self._stream.seek(pos) | |
151 | def tell(self): |
|
151 | def tell(self): | |
152 | return self._stream.tell() |
|
152 | return self._stream.tell() | |
|
153 | def chunks(self, progress=None): | |||
|
154 | return chunkiter(self, progress) | |||
|
155 | def chunk(self): | |||
|
156 | return getchunk(self) | |||
153 |
|
157 | |||
154 | class headerlessfixup(object): |
|
158 | class headerlessfixup(object): | |
155 | def __init__(self, fh, h): |
|
159 | def __init__(self, fh, h): |
@@ -1644,6 +1644,9 b' class localrepository(repo.repository):' | |||||
1644 | if not source: |
|
1644 | if not source: | |
1645 | return 0 |
|
1645 | return 0 | |
1646 |
|
1646 | |||
|
1647 | if not hasattr(source, 'chunk'): | |||
|
1648 | source = changegroup.unbundle10(source, 'UN') | |||
|
1649 | ||||
1647 | self.hook('prechangegroup', throw=True, source=srctype, url=url) |
|
1650 | self.hook('prechangegroup', throw=True, source=srctype, url=url) | |
1648 |
|
1651 | |||
1649 | changesets = files = revisions = 0 |
|
1652 | changesets = files = revisions = 0 | |
@@ -1671,8 +1674,8 b' class localrepository(repo.repository):' | |||||
1671 | total=self.total) |
|
1674 | total=self.total) | |
1672 | self.count += 1 |
|
1675 | self.count += 1 | |
1673 | pr = prog() |
|
1676 | pr = prog() | |
1674 | chunkiter = changegroup.chunkiter(source, progress=pr) |
|
1677 | if (cl.addgroup(source.chunks(pr), csmap, trp) is None | |
1675 | if cl.addgroup(chunkiter, csmap, trp) is None and not emptyok: |
|
1678 | and not emptyok): | |
1676 | raise util.Abort(_("received changelog group is empty")) |
|
1679 | raise util.Abort(_("received changelog group is empty")) | |
1677 | clend = len(cl) |
|
1680 | clend = len(cl) | |
1678 | changesets = clend - clstart |
|
1681 | changesets = clend - clstart | |
@@ -1686,12 +1689,11 b' class localrepository(repo.repository):' | |||||
1686 | pr.step = _('manifests') |
|
1689 | pr.step = _('manifests') | |
1687 | pr.count = 1 |
|
1690 | pr.count = 1 | |
1688 | pr.total = changesets # manifests <= changesets |
|
1691 | pr.total = changesets # manifests <= changesets | |
1689 | chunkiter = changegroup.chunkiter(source, progress=pr) |
|
|||
1690 | # no need to check for empty manifest group here: |
|
1692 | # no need to check for empty manifest group here: | |
1691 | # if the result of the merge of 1 and 2 is the same in 3 and 4, |
|
1693 | # if the result of the merge of 1 and 2 is the same in 3 and 4, | |
1692 | # no new manifest will be created and the manifest group will |
|
1694 | # no new manifest will be created and the manifest group will | |
1693 | # be empty during the pull |
|
1695 | # be empty during the pull | |
1694 |
self.manifest.addgroup( |
|
1696 | self.manifest.addgroup(source.chunks(pr), revmap, trp) | |
1695 | self.ui.progress(_('manifests'), None) |
|
1697 | self.ui.progress(_('manifests'), None) | |
1696 |
|
1698 | |||
1697 | needfiles = {} |
|
1699 | needfiles = {} | |
@@ -1710,15 +1712,14 b' class localrepository(repo.repository):' | |||||
1710 | pr.count = 1 |
|
1712 | pr.count = 1 | |
1711 | pr.total = efiles |
|
1713 | pr.total = efiles | |
1712 | while 1: |
|
1714 | while 1: | |
1713 |
f = c |
|
1715 | f = source.chunk() | |
1714 | if not f: |
|
1716 | if not f: | |
1715 | break |
|
1717 | break | |
1716 | self.ui.debug("adding %s revisions\n" % f) |
|
1718 | self.ui.debug("adding %s revisions\n" % f) | |
1717 | pr() |
|
1719 | pr() | |
1718 | fl = self.file(f) |
|
1720 | fl = self.file(f) | |
1719 | o = len(fl) |
|
1721 | o = len(fl) | |
1720 | chunkiter = changegroup.chunkiter(source) |
|
1722 | if fl.addgroup(source.chunks(), revmap, trp) is None: | |
1721 | if fl.addgroup(chunkiter, revmap, trp) is None: |
|
|||
1722 | raise util.Abort(_("received file revlog group is empty")) |
|
1723 | raise util.Abort(_("received file revlog group is empty")) | |
1723 | revisions += len(fl) - o |
|
1724 | revisions += len(fl) - o | |
1724 | files += 1 |
|
1725 | files += 1 |
General Comments 0
You need to be logged in to leave comments.
Login now