Mercurial > hg
changeset 33038:f0efd2bffe1e
bundle: extract _processchangegroup() method
The new method applies the changegroup and fills in op.records,
sharing a little bit of code between the two callers. We'll add
another caller soon.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 22 Jun 2017 15:59:07 -0700 |
parents | d765ad56081f |
children | b82615afde65 |
files | mercurial/bundle2.py |
diffstat | 1 files changed, 11 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/bundle2.py Thu Jun 22 14:04:13 2017 -0700 +++ b/mercurial/bundle2.py Thu Jun 22 15:59:07 2017 -0700 @@ -395,6 +395,14 @@ return op +def _processchangegroup(op, cg, tr, source, url, **kwargs): + ret, addednodes = cg.apply(op.repo, tr, source, url, **kwargs) + op.records.add('changegroup', { + 'return': ret, + 'addednodes': addednodes, + }) + return ret + def _processpart(op, part): """process a single part from a bundle @@ -1524,12 +1532,8 @@ op.repo.requirements.add('treemanifest') op.repo._applyopenerreqs() op.repo._writerequirements() - ret, addednodes = cg.apply(op.repo, tr, 'bundle2', 'bundle2', - expectedtotal=nbchangesets) - op.records.add('changegroup', { - 'return': ret, - 'addednodes': addednodes, - }) + ret = _processchangegroup(op, cg, tr, 'bundle2', 'bundle2', + expectedtotal=nbchangesets) if op.reply is not None: # This is definitely not the final form of this # return. But one need to start somewhere. @@ -1592,11 +1596,7 @@ if not isinstance(cg, changegroup.cg1unpacker): raise error.Abort(_('%s: not a bundle version 1.0') % util.hidepassword(raw_url)) - ret, addednodes = cg.apply(op.repo, tr, 'bundle2', 'bundle2') - op.records.add('changegroup', { - 'return': ret, - 'addednodes': addednodes, - }) + ret = _processchangegroup(op, cg, tr, 'bundle2', 'bundle2') if op.reply is not None: # This is definitely not the final form of this # return. But one need to start somewhere.