Mercurial > public > mercurial-scm > hg
comparison mercurial/bundle2.py @ 26698:c94cdeeb586a
bundle2: use cg?unpacker.apply() instead of changegroup.addchangegroup()
author | Augie Fackler <augie@google.com> |
---|---|
date | Tue, 13 Oct 2015 17:11:52 -0400 |
parents | ea390d889d3a |
children | 28a6c2d72097 |
comparison
equal
deleted
inserted
replaced
26697:008761affe3f | 26698:c94cdeeb586a |
---|---|
1269 # the source and url passed here are overwritten by the one contained in | 1269 # the source and url passed here are overwritten by the one contained in |
1270 # the transaction.hookargs argument. So 'bundle2' is a placeholder | 1270 # the transaction.hookargs argument. So 'bundle2' is a placeholder |
1271 nbchangesets = None | 1271 nbchangesets = None |
1272 if 'nbchanges' in inpart.params: | 1272 if 'nbchanges' in inpart.params: |
1273 nbchangesets = int(inpart.params.get('nbchanges')) | 1273 nbchangesets = int(inpart.params.get('nbchanges')) |
1274 ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2', | 1274 ret = cg.apply(op.repo, 'bundle2', 'bundle2', expectedtotal=nbchangesets) |
1275 expectedtotal=nbchangesets) | |
1276 op.records.add('changegroup', {'return': ret}) | 1275 op.records.add('changegroup', {'return': ret}) |
1277 if op.reply is not None: | 1276 if op.reply is not None: |
1278 # This is definitely not the final form of this | 1277 # This is definitely not the final form of this |
1279 # return. But one need to start somewhere. | 1278 # return. But one need to start somewhere. |
1280 part = op.reply.newpart('reply:changegroup', mandatory=False) | 1279 part = op.reply.newpart('reply:changegroup', mandatory=False) |
1339 from . import exchange | 1338 from . import exchange |
1340 cg = exchange.readbundle(op.repo.ui, real_part, raw_url) | 1339 cg = exchange.readbundle(op.repo.ui, real_part, raw_url) |
1341 if not isinstance(cg, changegroup.cg1unpacker): | 1340 if not isinstance(cg, changegroup.cg1unpacker): |
1342 raise error.Abort(_('%s: not a bundle version 1.0') % | 1341 raise error.Abort(_('%s: not a bundle version 1.0') % |
1343 util.hidepassword(raw_url)) | 1342 util.hidepassword(raw_url)) |
1344 ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2') | 1343 ret = cg.apply(op.repo, 'bundle2', 'bundle2') |
1345 op.records.add('changegroup', {'return': ret}) | 1344 op.records.add('changegroup', {'return': ret}) |
1346 if op.reply is not None: | 1345 if op.reply is not None: |
1347 # This is definitely not the final form of this | 1346 # This is definitely not the final form of this |
1348 # return. But one need to start somewhere. | 1347 # return. But one need to start somewhere. |
1349 part = op.reply.newpart('reply:changegroup') | 1348 part = op.reply.newpart('reply:changegroup') |