D289: bundle2: seek part back during iteration
durham (Durham Goode)
phabricator at mercurial-scm.org
Wed Aug 23 19:35:36 UTC 2017
durham updated this revision to Diff 1216.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D289?vs=659&id=1216
REVISION DETAIL
https://phab.mercurial-scm.org/D289
AFFECTED FILES
mercurial/bundle2.py
mercurial/bundlerepo.py
CHANGE DETAILS
diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -301,7 +301,6 @@
if cgstream is None:
raise error.Abort(_('No changegroups found'))
- cgstream.seek(0)
self.bundle = changegroup.getunbundler(version, cgstream, 'UN')
diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -828,7 +828,11 @@
while headerblock is not None:
part = unbundlepart(self.ui, headerblock, self._fp)
yield part
+ # Seek to the end of the part to force it's consumption so the next
+ # part can be read. But then seek back to the beginning so the
+ # code consuming this generator has a part that starts at 0.
part.seek(0, 2)
+ part.seek(0)
headerblock = self._readpartheader()
indebug(self.ui, 'end of bundle2 stream')
To: durham, #hg-reviewers, indygreg
Cc: martinvonz, indygreg, mercurial-devel
More information about the Mercurial-devel
mailing list