[PATCH] mq: make qrefresh/qfold keep wlock until saving patch status
Yuya Nishihara
yuya at tcha.org
Tue Jun 14 11:52:23 CDT 2011
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1308070249 -32400
# Node ID 14eeb4f74e006efdccd66343047d61d18330ce57
# Parent 6e631c24c6d9ba94c482c0b3ca6946aa4fcb8300
mq: make qrefresh/qfold keep wlock until saving patch status
Because q.refresh() changes nodeid, .hg/patches/status gets invalid until
q.savedirty(). This patch changes mq not to unlock repository of incomplete
state.
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -2275,9 +2275,13 @@ def refresh(ui, repo, *pats, **opts):
# We don't want to lose the patch message if qrefresh fails (issue2062)
repo.savecommitmessage(message)
setupheaderopts(ui, opts)
- ret = q.refresh(repo, pats, msg=message, **opts)
- q.savedirty()
- return ret
+ wlock = repo.wlock()
+ try:
+ ret = q.refresh(repo, pats, msg=message, **opts)
+ q.savedirty()
+ return ret
+ finally:
+ wlock.release()
@command("^qdiff",
commands.diffopts + commands.diffopts2 + commands.walkopts,
@@ -2366,9 +2370,13 @@ def fold(ui, repo, *files, **opts):
message = ui.edit(message, user or ui.username())
diffopts = q.patchopts(q.diffopts(), *patches)
- q.refresh(repo, msg=message, git=diffopts.git)
- q.delete(repo, patches, opts)
- q.savedirty()
+ wlock = repo.wlock()
+ try:
+ q.refresh(repo, msg=message, git=diffopts.git)
+ q.delete(repo, patches, opts)
+ q.savedirty()
+ finally:
+ wlock.release()
@command("qgoto",
[('f', 'force', None, _('overwrite any local changes'))],
More information about the Mercurial-devel
mailing list