# HG changeset patch # User Sean Farley # Date 1418249095 28800 # Node ID b5520673f6f243a511070d45e6c63ead2f3e135c # Parent 85fe080461c6a475619a4d6b1721447919316645 pull: adapt from upstream changes to transactions Mercurial rev 52db731b964d introduced a transaction manager upstream. This means that the closetransaction and releasetransaction methods on the pull operation have gone away. Code mostly based on Siddharth Agarwal's work on hg-git. diff --git a/hgsubversion/wrappers.py b/hgsubversion/wrappers.py --- a/hgsubversion/wrappers.py +++ b/hgsubversion/wrappers.py @@ -521,13 +521,23 @@ def pull(repo, source, heads=[], force=F def exchangepull(orig, repo, remote, heads=None, force=False, bookmarks=()): capable = getattr(remote, 'capable', lambda x: False) if capable('subversion'): + # transaction manager is present in Mercurial >= 3.3 + try: + trmanager = getattr(exchange, 'transactionmanager') + except AttributeError: + trmanager = None pullop = exchange.pulloperation(repo, remote, heads, force, bookmarks=bookmarks) + if trmanager: + pullop.trmanager = trmanager(repo, 'pull', remote.url()) try: pullop.cgresult = pull(repo, remote, heads, force) return pullop finally: - pullop.releasetransaction() + if trmanager: + pullop.trmanager.release() + else: + pullop.releasetransaction() else: return orig(repo, remote, heads, force, bookmarks=bookmarks)