Mercurial > hg > hg-git
changeset 842:ef904bd8d3fb
exchangepull: fixup for introduction of transaction manager upstream
Mercurial rev 52db731b964d introduced a transaction manager upstream. This
means that the closetransaction and releasetransaction methods on the pull
operation have gone away.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Fri, 05 Dec 2014 16:40:34 -0800 |
parents | edcdb7620f4d |
children | cf9dd81b61dc |
files | hggit/__init__.py |
diffstat | 1 files changed, 12 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/__init__.py +++ b/hggit/__init__.py @@ -219,15 +219,25 @@ @util.transform_notgit def exchangepull(orig, repo, remote, heads=None, force=False, bookmarks=()): if isinstance(remote, gitrepo.gitrepo): + # transaction manager is present in Mercurial >= 3.3 + trmanager = getattr(exchange, 'transactionmanager') pullop = exchange.pulloperation(repo, remote, heads, force, bookmarks=bookmarks) + if trmanager: + pullop.trmanager = trmanager(repo, 'pull', remote.url()) lock = repo.lock() try: pullop.cgresult = repo.githandler.fetch(remote.path, heads) - pullop.closetransaction() + if trmanager: + pullop.trmanager.close() + else: + pullop.closetransaction() return pullop finally: - pullop.releasetransaction() + if trmanager: + pullop.trmanager.release() + else: + pullop.releasetransaction() lock.release() else: return orig(repo, remote, heads, force, bookmarks=bookmarks)