# HG changeset patch # User Patrick Mezard # Date 1345879925 -7200 # Node ID 18854dbc92e7abc2bfe46a66872ac0c7217811a5 # Parent 0b60c28d9c43318c532487874b7cd74e38ca3367 evolve: simplify locking in _solveconflicting() diff -r 0b60c28d9c43 -r 18854dbc92e7 hgext/evolve.py --- a/hgext/evolve.py Sat Aug 25 09:18:40 2012 +0200 +++ b/hgext/evolve.py Sat Aug 25 09:32:05 2012 +0200 @@ -1554,48 +1554,46 @@ ui.write('hg commit -m "`hg log -r %s --template={desc}`";\n' % conflicting) return #oldphase = max(conflicting.phase(), other.phase()) - wlock = repo.wlock() + wlock = lock = None try: + wlock = repo.wlock() lock = repo.lock() + if conflicting not in repo[None].parents(): + repo.ui.status(_('updating to "local" conflict\n')) + hg.update(repo, conflicting.rev()) + repo.ui.note(_('merging conflicting changeset\n')) + stats = merge.update(repo, + other.node(), + branchmerge=True, + force=False, + partial=None, + ancestor=base.node(), + mergeancestor=True) + hg._showstats(repo, stats) + if stats[3]: + repo.ui.status(_("use 'hg resolve' to retry unresolved file merges " + "or 'hg update -C .' to abandon\n")) + #repo.dirstate.write() + if stats[3] > 0: + raise util.Abort('GASP! Merge Conflict! You are on you own chap!', + hint='/!\\ hg evolve --continue will NOT work /!\\') + tr = repo.transaction('stabilize-conflicting') try: - if conflicting not in repo[None].parents(): - repo.ui.status(_('updating to "local" conflict\n')) - hg.update(repo, conflicting.rev()) - repo.ui.note(_('merging conflicting changeset\n')) - stats = merge.update(repo, - other.node(), - branchmerge=True, - force=False, - partial=None, - ancestor=base.node(), - mergeancestor=True) - hg._showstats(repo, stats) - if stats[3]: - repo.ui.status(_("use 'hg resolve' to retry unresolved file merges " - "or 'hg update -C .' to abandon\n")) - #repo.dirstate.write() - if stats[3] > 0: - raise util.Abort('GASP! Merge Conflict! You are on you own chap!', - hint='/!\\ hg evolve --continue will NOT work /!\\') - tr = repo.transaction('stabilize-conflicting') - try: - repo.dirstate.setparents(conflicting.node(), node.nullid) - oldlen = len(repo) - amend(ui, repo) - if oldlen == len(repo): - new = conflicting - # no changes - else: - new = repo['.'] - createmarkers(repo, [(other, (new,))]) - phases.retractboundary(repo, other.phase(), [new.node()]) - tr.close() - finally: - tr.release() + repo.dirstate.setparents(conflicting.node(), node.nullid) + oldlen = len(repo) + amend(ui, repo) + if oldlen == len(repo): + new = conflicting + # no changes + else: + new = repo['.'] + createmarkers(repo, [(other, (new,))]) + phases.retractboundary(repo, other.phase(), [new.node()]) + tr.close() finally: - lock.release() + tr.release() finally: - wlock.release() + lockmod.release(lock, wlock) def conflictingdata(ctx):