Mercurial > public > mercurial-scm > hg
diff mercurial/changegroup.py @ 32930:af31d531dda0
changegroup: let callers pass in transaction to apply() (API)
I think passing in the transaction makes it a little clearer and more
consistent with bundle2.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 15 Jun 2017 22:46:38 -0700 |
parents | 038bfc384271 |
children | b08431e1b062 |
line wrap: on
line diff
--- a/mercurial/changegroup.py Thu Jun 15 23:09:14 2017 -0700 +++ b/mercurial/changegroup.py Thu Jun 15 22:46:38 2017 -0700 @@ -256,7 +256,7 @@ repo.ui.progress(_('manifests'), None) self.callback = None - def apply(self, repo, srctype, url, emptyok=False, + def apply(self, repo, tr, srctype, url, emptyok=False, targetphase=phases.draft, expectedtotal=None): """Add the changegroup returned by source.read() to this repo. srctype is a string like 'push', 'pull', or 'unbundle'. url is @@ -279,12 +279,11 @@ changesets = files = revisions = 0 try: - with repo.transaction("\n".join([srctype, - util.hidepassword(url)])) as tr: - # The transaction could have been created before and already - # carries source information. In this case we use the top - # level data. We overwrite the argument because we need to use - # the top level value (if they exist) in this function. + if True: + # The transaction may already carry source information. In this + # case we use the top level data. We overwrite the argument + # because we need to use the top level value (if they exist) + # in this function. srctype = tr.hookargs.setdefault('source', srctype) url = tr.hookargs.setdefault('url', url) repo.hook('prechangegroup', throw=True, **tr.hookargs)