comparison mercurial/cmdutil.py @ 25758:c5dfa47ad7ee

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".
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Wed, 08 Jul 2015 17:01:09 +0900
parents 72d395e399c1
children ff11c1565c04
comparison
equal deleted inserted replaced
25757:4d1382fd96ff 25758:c5dfa47ad7ee
218 if tobackup: 218 if tobackup:
219 os.rmdir(backupdir) 219 os.rmdir(backupdir)
220 except OSError: 220 except OSError:
221 pass 221 pass
222 222
223 return commit(ui, repo, recordfunc, pats, opts) 223 def recordinwlock(ui, repo, message, match, opts):
224 wlock = repo.wlock()
225 try:
226 return recordfunc(ui, repo, message, match, opts)
227 finally:
228 wlock.release()
229
230 return commit(ui, repo, recordinwlock, pats, opts)
224 231
225 def findpossible(cmd, table, strict=False): 232 def findpossible(cmd, table, strict=False):
226 """ 233 """
227 Return cmd -> (aliases, command table entry) 234 Return cmd -> (aliases, command table entry)
228 for each matching command. 235 for each matching command.