# HG changeset patch # User Augie Fackler # Date 1508978814 14400 # Node ID 0212c3a84ccd3d69eee691f77f6f0f53f1870a21 # Parent ae01b360320bbb60d1f09968c47960d0e302a6a2 wrappers: add some missing lock/wlock grabbing Caught with a hack to turn develwarns into crashes. Unfortunately, I can't check that in because a couple of commitctx() calls in tests turn into deadlocks when I try and fix them. diff --git a/hgsubversion/wrappers.py b/hgsubversion/wrappers.py --- a/hgsubversion/wrappers.py +++ b/hgsubversion/wrappers.py @@ -354,18 +354,19 @@ def push(repo, dest, force, revs): finally: util.swap_out_encoding() - with repo.lock(): - if hasobsolete: - for marker in obsmarkers: - obsolete.createmarkers(repo, marker) - beforepush = marker[0][0] - afterpush = marker[0][1][0] - ui.note('marking %s as obsoleted by %s\n' % - (beforepush.hex(), afterpush.hex())) - else: - # strip the original changesets since the push was - # successful and changeset obsolescence is unavailable - util.strip(ui, repo, outgoing, "all") + with repo.wlock(): + with repo.lock(): + if hasobsolete: + for marker in obsmarkers: + obsolete.createmarkers(repo, marker) + beforepush = marker[0][0] + afterpush = marker[0][1][0] + ui.note('marking %s as obsoleted by %s\n' % + (beforepush.hex(), afterpush.hex())) + else: + # strip the original changesets since the push was + # successful and changeset obsolescence is unavailable + util.strip(ui, repo, outgoing, "all") finally: try: # It's always safe to delete the temporary commits. @@ -377,12 +378,15 @@ def push(repo, dest, force, revs): parent = repo[None].p1() if parent.node() in temporary_commits: hg.update(repo, parent.p1().node()) - with repo.lock(): - if hasobsolete: - relations = ((repo[n], ()) for n in temporary_commits) - obsolete.createmarkers(repo, relations) - else: - util.strip(ui, repo, temporary_commits, backup=None) + with repo.wlock(): + with repo.lock(): + if hasobsolete: + relations = ( + (repo[n], ()) for n in temporary_commits) + obsolete.createmarkers(repo, relations) + else: + util.strip( + ui, repo, temporary_commits, backup=None) finally: util.swap_out_encoding(old_encoding)