# HG changeset patch # User Yuya Nishihara # Date 2011-06-14 16:50:49 # Node ID 2b9c32929e62b015bf463dbe32e5ac325e51fbe0 # Parent 29f55c0e39e7c6c24a8b366b72b0a4c7152a664e 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'))],