Mercurial > hg
changeset 25796:4eb8d8a44bf1
record: omit meaningless 'commit' suggestion at 'hg commit -i'
Before this patch, 'hg commit -i' under non-interactive mode suggests
'use commit instead', and it obviously meaningless.
This patch makes 'record.record'()' examine 'ui.interactive()' and
show suggestion by itself before calling 'commands.commit()'.
This allows 'commands.commit()' to specify 'None' for 'cmdsuggest'
argument of 'cmdutil.dorecord()' to omit meaningless 'commit'
suggestion at 'hg commit -i'.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Wed, 15 Jul 2015 04:45:58 +0900 |
parents | 69145daacdfa |
children | cc9fb45986d4 |
files | hgext/record.py mercurial/commands.py tests/test-commit-interactive.t |
diffstat | 3 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/record.py Wed Jul 15 03:43:16 2015 +0900 +++ b/hgext/record.py Wed Jul 15 04:45:58 2015 +0900 @@ -53,6 +53,10 @@ This command is not available when committing a merge.''' + if not ui.interactive(): + raise util.Abort(_('running non-interactively, use %s instead') % + 'commit') + opts["interactive"] = True backup = ui.backupconfig('experimental', 'crecord') try:
--- a/mercurial/commands.py Wed Jul 15 03:43:16 2015 +0900 +++ b/mercurial/commands.py Wed Jul 15 04:45:58 2015 +0900 @@ -1480,7 +1480,7 @@ """ if opts.get('interactive'): opts.pop('interactive') - cmdutil.dorecord(ui, repo, commit, 'commit', False, + cmdutil.dorecord(ui, repo, commit, None, False, cmdutil.recordfilter, *pats, **opts) return
--- a/tests/test-commit-interactive.t Wed Jul 15 03:43:16 2015 +0900 +++ b/tests/test-commit-interactive.t Wed Jul 15 04:45:58 2015 +0900 @@ -15,6 +15,12 @@ $ touch empty-rw $ hg add empty-rw + $ hg record --config ui.interactive=false + abort: running non-interactively, use commit instead + [255] + $ hg commit -i --config ui.interactive=false + abort: running non-interactively + [255] $ hg commit -i empty-rw<<EOF > n > EOF