Show More
@@ -142,6 +142,7 b' class unbundle10(object):' | |||||
142 | def __init__(self, fh, alg): |
|
142 | def __init__(self, fh, alg): | |
143 | self._stream = decompressor(fh, alg) |
|
143 | self._stream = decompressor(fh, alg) | |
144 | self._type = alg |
|
144 | self._type = alg | |
|
145 | self.callback = None | |||
145 | def compressed(self): |
|
146 | def compressed(self): | |
146 | return self._type != 'UN' |
|
147 | return self._type != 'UN' | |
147 | def read(self, l): |
|
148 | def read(self, l): | |
@@ -150,10 +151,32 b' class unbundle10(object):' | |||||
150 | return self._stream.seek(pos) |
|
151 | return self._stream.seek(pos) | |
151 | def tell(self): |
|
152 | def tell(self): | |
152 | return self._stream.tell() |
|
153 | return self._stream.tell() | |
153 | def chunks(self, progress=None): |
|
154 | ||
154 | return chunkiter(self, progress) |
|
155 | def chunklength(self): | |
|
156 | d = self.read(4) | |||
|
157 | if not d: | |||
|
158 | return 0 | |||
|
159 | l = max(0, struct.unpack(">l", d)[0] - 4) | |||
|
160 | if l and self.callback: | |||
|
161 | self.callback() | |||
|
162 | return l | |||
|
163 | ||||
155 | def chunk(self): |
|
164 | def chunk(self): | |
156 | return getchunk(self) |
|
165 | """return the next chunk from changegroup 'source' as a string""" | |
|
166 | l = self.chunklength() | |||
|
167 | d = self.read(l) | |||
|
168 | if len(d) < l: | |||
|
169 | raise util.Abort(_("premature EOF reading chunk" | |||
|
170 | " (got %d bytes, expected %d)") | |||
|
171 | % (len(d), l)) | |||
|
172 | return d | |||
|
173 | ||||
|
174 | def chunks(self): | |||
|
175 | while 1: | |||
|
176 | c = self.chunk() | |||
|
177 | if not c: | |||
|
178 | break | |||
|
179 | yield c | |||
157 |
|
180 | |||
158 | class headerlessfixup(object): |
|
181 | class headerlessfixup(object): | |
159 | def __init__(self, fh, h): |
|
182 | def __init__(self, fh, h): |
@@ -1674,7 +1674,9 b' class localrepository(repo.repository):' | |||||
1674 | total=self.total) |
|
1674 | total=self.total) | |
1675 | self.count += 1 |
|
1675 | self.count += 1 | |
1676 | pr = prog() |
|
1676 | pr = prog() | |
1677 | if (cl.addgroup(source.chunks(pr), csmap, trp) is None |
|
1677 | source.callback = pr | |
|
1678 | ||||
|
1679 | if (cl.addgroup(source.chunks(), csmap, trp) is None | |||
1678 | and not emptyok): |
|
1680 | and not emptyok): | |
1679 | raise util.Abort(_("received changelog group is empty")) |
|
1681 | raise util.Abort(_("received changelog group is empty")) | |
1680 | clend = len(cl) |
|
1682 | clend = len(cl) | |
@@ -1693,7 +1695,7 b' class localrepository(repo.repository):' | |||||
1693 | # if the result of the merge of 1 and 2 is the same in 3 and 4, |
|
1695 | # if the result of the merge of 1 and 2 is the same in 3 and 4, | |
1694 | # no new manifest will be created and the manifest group will |
|
1696 | # no new manifest will be created and the manifest group will | |
1695 | # be empty during the pull |
|
1697 | # be empty during the pull | |
1696 |
self.manifest.addgroup(source.chunks( |
|
1698 | self.manifest.addgroup(source.chunks(), revmap, trp) | |
1697 | self.ui.progress(_('manifests'), None) |
|
1699 | self.ui.progress(_('manifests'), None) | |
1698 |
|
1700 | |||
1699 | needfiles = {} |
|
1701 | needfiles = {} | |
@@ -1711,6 +1713,8 b' class localrepository(repo.repository):' | |||||
1711 | pr.step = 'files' |
|
1713 | pr.step = 'files' | |
1712 | pr.count = 1 |
|
1714 | pr.count = 1 | |
1713 | pr.total = efiles |
|
1715 | pr.total = efiles | |
|
1716 | source.callback = None | |||
|
1717 | ||||
1714 | while 1: |
|
1718 | while 1: | |
1715 | f = source.chunk() |
|
1719 | f = source.chunk() | |
1716 | if not f: |
|
1720 | if not f: |
General Comments 0
You need to be logged in to leave comments.
Login now