# HG changeset patch # User Patrick Mezard # Date 1345879120 -7200 # Node ID 0b60c28d9c43318c532487874b7cd74e38ca3367 # Parent ea667749ccd10323b9f21ddba18b38f4b6fe5a0a fold: simplify locking diff -r ea667749ccd1 -r 0b60c28d9c43 hgext/evolve.py --- a/hgext/evolve.py Sat Aug 25 09:20:15 2012 +0200 +++ b/hgext/evolve.py Sat Aug 25 09:18:40 2012 +0200 @@ -2040,31 +2040,29 @@ if len(heads) > 1: raise util.Abort("set have multiple heads") head = repo[heads[0]] - wlock = repo.wlock() + wlock = lock = None try: + wlock = repo.wlock() lock = repo.lock() + tr = repo.transaction('touch') try: - tr = repo.transaction('touch') - try: - allctx = [repo[r] for r in revs] - targetphase = max(c.phase() for c in allctx) - msg = '\n\n***\n\n'.join(c.description() for c in allctx) - newid, _ = rewrite(repo, root, allctx, head, - [root.p1().node(), root.p2().node()], - commitopts={'message': msg}) - phases.retractboundary(repo, targetphase, [newid]) - createmarkers(repo, [(ctx, (repo[newid],)) - for ctx in allctx]) - tr.close() - finally: - tr.release() + allctx = [repo[r] for r in revs] + targetphase = max(c.phase() for c in allctx) + msg = '\n\n***\n\n'.join(c.description() for c in allctx) + newid, _ = rewrite(repo, root, allctx, head, + [root.p1().node(), root.p2().node()], + commitopts={'message': msg}) + phases.retractboundary(repo, targetphase, [newid]) + createmarkers(repo, [(ctx, (repo[newid],)) + for ctx in allctx]) + tr.close() finally: - lock.release() + tr.release() ui.status('%i changesets folded\n' % len(revs)) if repo.revs('. and %ld', revs): repo.dirstate.setparents(newid, node.nullid) finally: - wlock.release() + lockmod.release(lock, wlock) @eh.wrapcommand('graft')