# HG changeset patch # User FUJIWARA Katsunori # Date 1436342469 -32400 # Node ID c5dfa47ad7ee618e8e5cec825de66e2c7349d5e8 # Parent 4d1382fd96fff7df46873a6454c6107e35742ceb cmdutil: put recordfunc invocation into wlock scope for consistency Before this patch, 'recordfunc()' for interactive hunk selection does below outside wlock scope at 'hg commit -i' and so on: - backup files, which may be partially changed - apply selected hunks on files - restore files from backup-ed ones These should be executed inside wlock scope for consistency. To put them into wlock scope without largely changing indents in 'recordfunc()', this patch adds another wrapper function. This patch is also a preparation for subsequent patch fixing the issue to correctly recognize partially committed files as "modified". diff -r 4d1382fd96ff -r c5dfa47ad7ee mercurial/cmdutil.py --- a/mercurial/cmdutil.py Wed Jul 08 17:01:09 2015 +0900 +++ b/mercurial/cmdutil.py Wed Jul 08 17:01:09 2015 +0900 @@ -220,7 +220,14 @@ except OSError: pass - return commit(ui, repo, recordfunc, pats, opts) + def recordinwlock(ui, repo, message, match, opts): + wlock = repo.wlock() + try: + return recordfunc(ui, repo, message, match, opts) + finally: + wlock.release() + + return commit(ui, repo, recordinwlock, pats, opts) def findpossible(cmd, table, strict=False): """