--- a/hgext/evolve.py Wed Aug 06 17:40:55 2014 -0700
+++ b/hgext/evolve.py Wed Aug 06 17:08:51 2014 -0700
@@ -1953,44 +1953,43 @@
Return 0 if changed files are uncommitted.
"""
- lock = repo.lock()
+
+ wlock = lock = None
try:
wlock = repo.wlock()
- try:
- wctx = repo[None]
- if len(wctx.parents()) <= 0:
- raise util.Abort(_("cannot uncommit null changeset"))
- if len(wctx.parents()) > 1:
- raise util.Abort(_("cannot uncommit while merging"))
- old = repo['.']
- if old.phase() == phases.public:
- raise util.Abort(_("cannot rewrite immutable changeset"))
- if len(old.parents()) > 1:
- raise util.Abort(_("cannot uncommit merge changeset"))
- oldphase = old.phase()
- updatebookmarks = _bookmarksupdater(repo, old.node())
- # Recommit the filtered changeset
- newid = None
- if (pats or opts.get('include') or opts.get('exclude')
- or opts.get('all')):
- match = scmutil.match(old, pats, opts)
- newid = _commitfiltered(repo, old, match)
- if newid is None:
- raise util.Abort(_('nothing to uncommit'),
- hint=_("use --all to uncommit all files"))
- # Move local changes on filtered changeset
- createmarkers(repo, [(old, (repo[newid],))])
- retractboundary(repo, oldphase, [newid])
- repo.dirstate.setparents(newid, node.nullid)
- _uncommitdirstate(repo, old, match)
- updatebookmarks(newid)
- if not repo[newid].files():
- ui.warn(_("new changeset is empty\n"))
- ui.status(_('(use "hg prune ." to remove it)\n'))
- finally:
- wlock.release()
+ lock = repo.lock()
+ wctx = repo[None]
+ if len(wctx.parents()) <= 0:
+ raise util.Abort(_("cannot uncommit null changeset"))
+ if len(wctx.parents()) > 1:
+ raise util.Abort(_("cannot uncommit while merging"))
+ old = repo['.']
+ if old.phase() == phases.public:
+ raise util.Abort(_("cannot rewrite immutable changeset"))
+ if len(old.parents()) > 1:
+ raise util.Abort(_("cannot uncommit merge changeset"))
+ oldphase = old.phase()
+ updatebookmarks = _bookmarksupdater(repo, old.node())
+ # Recommit the filtered changeset
+ newid = None
+ if (pats or opts.get('include') or opts.get('exclude')
+ or opts.get('all')):
+ match = scmutil.match(old, pats, opts)
+ newid = _commitfiltered(repo, old, match)
+ if newid is None:
+ raise util.Abort(_('nothing to uncommit'),
+ hint=_("use --all to uncommit all files"))
+ # Move local changes on filtered changeset
+ createmarkers(repo, [(old, (repo[newid],))])
+ retractboundary(repo, oldphase, [newid])
+ repo.dirstate.setparents(newid, node.nullid)
+ _uncommitdirstate(repo, old, match)
+ updatebookmarks(newid)
+ if not repo[newid].files():
+ ui.warn(_("new changeset is empty\n"))
+ ui.status(_('(use "hg prune ." to remove it)\n'))
finally:
- lock.release()
+ lockmod.release(lock, wlock)
@eh.wrapcommand('commit')
def commitwrapper(orig, ui, repo, *arg, **kwargs):