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".
--- 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):
"""