Mercurial > hgsubversion
changeset 1279:b5520673f6f2 stable
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.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Wed, 10 Dec 2014 14:04:55 -0800 |
parents | 85fe080461c6 |
children | c791efb7082a 553c40023729 |
files | hgsubversion/wrappers.py |
diffstat | 1 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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)