Mercurial > hg
comparison hgext/transplant.py @ 27840:dc237afacbd4
with: use context manager for wlock in transplant
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Fri, 15 Jan 2016 13:14:47 -0800 |
parents | b97004648028 |
children | dcb4209bd30d |
comparison
equal
deleted
inserted
replaced
27839:7ec3cb246291 | 27840:dc237afacbd4 |
---|---|
18 import os, tempfile | 18 import os, tempfile |
19 from mercurial.node import short | 19 from mercurial.node import short |
20 from mercurial import bundlerepo, hg, merge, match | 20 from mercurial import bundlerepo, hg, merge, match |
21 from mercurial import patch, revlog, scmutil, util, error, cmdutil | 21 from mercurial import patch, revlog, scmutil, util, error, cmdutil |
22 from mercurial import revset, templatekw, exchange | 22 from mercurial import revset, templatekw, exchange |
23 from mercurial import lock as lockmod | |
24 | 23 |
25 class TransplantError(error.Abort): | 24 class TransplantError(error.Abort): |
26 pass | 25 pass |
27 | 26 |
28 cmdtable = {} | 27 cmdtable = {} |
573 | 572 |
574 If a changeset application fails, you can fix the merge by hand | 573 If a changeset application fails, you can fix the merge by hand |
575 and then resume where you left off by calling :hg:`transplant | 574 and then resume where you left off by calling :hg:`transplant |
576 --continue/-c`. | 575 --continue/-c`. |
577 ''' | 576 ''' |
578 wlock = None | 577 with repo.wlock(): |
579 try: | |
580 wlock = repo.wlock() | |
581 return _dotransplant(ui, repo, *revs, **opts) | 578 return _dotransplant(ui, repo, *revs, **opts) |
582 finally: | |
583 lockmod.release(wlock) | |
584 | 579 |
585 def _dotransplant(ui, repo, *revs, **opts): | 580 def _dotransplant(ui, repo, *revs, **opts): |
586 def incwalk(repo, csets, match=util.always): | 581 def incwalk(repo, csets, match=util.always): |
587 for node in csets: | 582 for node in csets: |
588 if match(node): | 583 if match(node): |