diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py index 697d8953b04d88c5da40ccb94db289b3eeb403db_bWVyY3VyaWFsL2J1bmRsZTIucHk=..b44ee346211fad97f4f2497b705dc9fda6cfd092_bWVyY3VyaWFsL2J1bmRsZTIucHk= 100644 --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -483,7 +483,7 @@ outdebug(self.ui, 'start of parts') for part in self._parts: outdebug(self.ui, 'bundle part: "%s"' % part.type) - for chunk in part.getchunks(): + for chunk in part.getchunks(ui=self.ui): yield chunk outdebug(self.ui, 'end of bundle') yield _pack(_fpartheadersize, 0) @@ -726,7 +726,7 @@ params.append((name, value)) # methods used to generates the bundle2 stream - def getchunks(self): + def getchunks(self, ui): if self._generated is not None: raise RuntimeError('part can only be consumed once') self._generated = False @@ -735,6 +735,7 @@ parttype = self.type.upper() else: parttype = self.type.lower() + outdebug(ui, 'part %s: "%s"' % (self.id, parttype)) ## parttype header = [_pack(_fparttypesize, len(parttype)), parttype, _pack(_fpartid, self.id), @@ -763,8 +764,9 @@ header.append(value) ## finalize header headerchunk = ''.join(header) + outdebug(ui, 'header chunk size: %i' % len(headerchunk)) yield _pack(_fpartheadersize, len(headerchunk)) yield headerchunk ## payload try: for chunk in self._payloadchunks(): @@ -766,8 +768,9 @@ yield _pack(_fpartheadersize, len(headerchunk)) yield headerchunk ## payload try: for chunk in self._payloadchunks(): + outdebug(ui, 'payload chunk size: %i' % len(chunk)) yield _pack(_fpayloadsize, len(chunk)) yield chunk except BaseException, exc: @@ -778,5 +781,5 @@ mandatory=False) interpart.id = 0 yield _pack(_fpayloadsize, -1) - for chunk in interpart.getchunks(): + for chunk in interpart.getchunks(ui=ui): yield chunk @@ -782,5 +785,6 @@ yield chunk + outdebug(ui, 'closing payload chunk') # abort current part payload yield _pack(_fpayloadsize, 0) raise exc_info[0], exc_info[1], exc_info[2] # end of payload @@ -783,7 +787,8 @@ # abort current part payload yield _pack(_fpayloadsize, 0) raise exc_info[0], exc_info[1], exc_info[2] # end of payload + outdebug(ui, 'closing payload chunk') yield _pack(_fpayloadsize, 0) self._generated = True diff --git a/tests/test-bundle2-format.t b/tests/test-bundle2-format.t index 697d8953b04d88c5da40ccb94db289b3eeb403db_dGVzdHMvdGVzdC1idW5kbGUyLWZvcm1hdC50..b44ee346211fad97f4f2497b705dc9fda6cfd092_dGVzdHMvdGVzdC1idW5kbGUyLWZvcm1hdC50 100644 --- a/tests/test-bundle2-format.t +++ b/tests/test-bundle2-format.t @@ -388,4 +388,7 @@ bundle2-output: bundle parameter: bundle2-output: start of parts bundle2-output: bundle part: "test:empty" + bundle2-output: part 0: "test:empty" + bundle2-output: header chunk size: 17 + bundle2-output: closing payload chunk bundle2-output: bundle part: "test:empty" @@ -391,2 +394,5 @@ bundle2-output: bundle part: "test:empty" + bundle2-output: part 1: "test:empty" + bundle2-output: header chunk size: 17 + bundle2-output: closing payload chunk bundle2-output: bundle part: "test:song" @@ -392,2 +398,6 @@ bundle2-output: bundle part: "test:song" + bundle2-output: part 2: "test:song" + bundle2-output: header chunk size: 16 + bundle2-output: payload chunk size: 178 + bundle2-output: closing payload chunk bundle2-output: bundle part: "test:debugreply" @@ -393,2 +403,5 @@ bundle2-output: bundle part: "test:debugreply" + bundle2-output: part 3: "test:debugreply" + bundle2-output: header chunk size: 22 + bundle2-output: closing payload chunk bundle2-output: bundle part: "test:math" @@ -394,2 +407,6 @@ bundle2-output: bundle part: "test:math" + bundle2-output: part 4: "test:math" + bundle2-output: header chunk size: 43 + bundle2-output: payload chunk size: 2 + bundle2-output: closing payload chunk bundle2-output: bundle part: "test:song" @@ -395,2 +412,5 @@ bundle2-output: bundle part: "test:song" + bundle2-output: part 5: "test:song" + bundle2-output: header chunk size: 29 + bundle2-output: closing payload chunk bundle2-output: bundle part: "test:ping" @@ -396,4 +416,7 @@ bundle2-output: bundle part: "test:ping" + bundle2-output: part 6: "test:ping" + bundle2-output: header chunk size: 16 + bundle2-output: closing payload chunk bundle2-output: end of bundle $ cat ../parts.hg2 @@ -715,6 +738,8 @@ bundle2-output: bundle parameter: bundle2-output: start of parts bundle2-output: bundle part: "changegroup" + bundle2-output: part 0: "changegroup" + bundle2-output: header chunk size: 18 bundling: 1/4 changesets (25.00%) bundling: 2/4 changesets (50.00%) bundling: 3/4 changesets (75.00%) @@ -726,6 +751,8 @@ bundling: D 1/3 files (33.33%) bundling: E 2/3 files (66.67%) bundling: H 3/3 files (100.00%) + bundle2-output: payload chunk size: 1555 + bundle2-output: closing payload chunk bundle2-output: end of bundle $ cat ../rev.hg2