# HG changeset patch # User Siddharth Agarwal <sid0@fb.com> # Date 1417826434 28800 # Fri Dec 05 16:40:34 2014 -0800 # Node ID ef904bd8d3fb65c0baa216f90075c2e1cfb853a2 # Parent edcdb7620f4d4a82d2c936131d319e62198a6e05 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. diff --git a/hggit/__init__.py b/hggit/__init__.py --- 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)