diff --git a/hggit/__init__.py b/hggit/__init__.py index edcdb7620f4d4a82d2c936131d319e62198a6e05_aGdnaXQvX19pbml0X18ucHk=..ef904bd8d3fb65c0baa216f90075c2e1cfb853a2_aGdnaXQvX19pbml0X18ucHk= 100644 --- a/hggit/__init__.py +++ b/hggit/__init__.py @@ -219,5 +219,7 @@ @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) @@ -222,5 +224,7 @@ 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) @@ -224,6 +228,9 @@ 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: @@ -228,6 +235,9 @@ return pullop finally: - pullop.releasetransaction() + if trmanager: + pullop.trmanager.release() + else: + pullop.releasetransaction() lock.release() else: return orig(repo, remote, heads, force, bookmarks=bookmarks)