comparison mercurial/bundle2.py @ 33030:3e102a8dd52c

bundle2: record changegroup data in 'op.records' (API) When adding support for bundling and unbundling phases, it will be useful to have the list of added changesets. To do that, we return the list from changegroup.apply().
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 16 Jun 2017 16:56:16 -0700
parents 560ceb654180
children e8c8d81eb864
comparison
equal deleted inserted replaced
33029:b482d80e041b 33030:3e102a8dd52c
1490 "bundle contains tree manifests, but local repo is " 1490 "bundle contains tree manifests, but local repo is "
1491 "non-empty and does not use tree manifests")) 1491 "non-empty and does not use tree manifests"))
1492 op.repo.requirements.add('treemanifest') 1492 op.repo.requirements.add('treemanifest')
1493 op.repo._applyopenerreqs() 1493 op.repo._applyopenerreqs()
1494 op.repo._writerequirements() 1494 op.repo._writerequirements()
1495 ret = cg.apply(op.repo, tr, 'bundle2', 'bundle2', 1495 ret, addednodes = cg.apply(op.repo, tr, 'bundle2', 'bundle2',
1496 expectedtotal=nbchangesets) 1496 expectedtotal=nbchangesets)
1497 op.records.add('changegroup', {'return': ret}) 1497 op.records.add('changegroup', {
1498 'return': ret,
1499 'addednodes': addednodes,
1500 })
1498 if op.reply is not None: 1501 if op.reply is not None:
1499 # This is definitely not the final form of this 1502 # This is definitely not the final form of this
1500 # return. But one need to start somewhere. 1503 # return. But one need to start somewhere.
1501 part = op.reply.newpart('reply:changegroup', mandatory=False) 1504 part = op.reply.newpart('reply:changegroup', mandatory=False)
1502 part.addparam('in-reply-to', str(inpart.id), mandatory=False) 1505 part.addparam('in-reply-to', str(inpart.id), mandatory=False)
1555 from . import exchange 1558 from . import exchange
1556 cg = exchange.readbundle(op.repo.ui, real_part, raw_url) 1559 cg = exchange.readbundle(op.repo.ui, real_part, raw_url)
1557 if not isinstance(cg, changegroup.cg1unpacker): 1560 if not isinstance(cg, changegroup.cg1unpacker):
1558 raise error.Abort(_('%s: not a bundle version 1.0') % 1561 raise error.Abort(_('%s: not a bundle version 1.0') %
1559 util.hidepassword(raw_url)) 1562 util.hidepassword(raw_url))
1560 ret = cg.apply(op.repo, tr, 'bundle2', 'bundle2') 1563 ret, addednodes = cg.apply(op.repo, tr, 'bundle2', 'bundle2')
1561 op.records.add('changegroup', {'return': ret}) 1564 op.records.add('changegroup', {
1565 'return': ret,
1566 'addednodes': addednodes,
1567 })
1562 if op.reply is not None: 1568 if op.reply is not None:
1563 # This is definitely not the final form of this 1569 # This is definitely not the final form of this
1564 # return. But one need to start somewhere. 1570 # return. But one need to start somewhere.
1565 part = op.reply.newpart('reply:changegroup') 1571 part = op.reply.newpart('reply:changegroup')
1566 part.addparam('in-reply-to', str(inpart.id), mandatory=False) 1572 part.addparam('in-reply-to', str(inpart.id), mandatory=False)