# HG changeset patch # User FUJIWARA Katsunori # Date 1399736976 -32400 # Node ID 3e717c9376fc63ef15976d42d2ba9dbcc9a0eeb2 # Parent 0b5d6c062774d7be2e3369888f75e6976c66d645 graft: use "getcommiteditor()" instead of explicit editor choice This patch also enhances "test-graft.t", because "hg graft" hasn't been explicitly tested around editor invocation and "--edit" option. diff -r 0b5d6c062774 -r 3e717c9376fc mercurial/commands.py --- a/mercurial/commands.py Sun May 11 00:49:36 2014 +0900 +++ b/mercurial/commands.py Sun May 11 00:49:36 2014 +0900 @@ -3071,9 +3071,7 @@ if not opts.get('date') and opts.get('currentdate'): opts['date'] = "%d %d" % util.makedate() - editor = None - if opts.get('edit'): - editor = cmdutil.commitforceeditor + editor = cmdutil.getcommiteditor(**opts) cont = False if opts['continue']: diff -r 0b5d6c062774 -r 3e717c9376fc tests/test-graft.t --- a/tests/test-graft.t Sun May 11 00:49:36 2014 +0900 +++ b/tests/test-graft.t Sun May 11 00:49:36 2014 +0900 @@ -76,10 +76,24 @@ $ hg revert a Graft a rename: +(this also tests that editor is invoked if '--edit' is specified) - $ hg graft 2 -u foo + $ hg status --rev "2^1" --rev 2 + A b + R a + $ HGEDITOR=cat hg graft 2 -u foo --edit grafting revision 2 merging a and b to b + 2 + + + HG: Enter commit message. Lines beginning with 'HG:' are removed. + HG: Leave message empty to abort commit. + HG: -- + HG: user: foo + HG: branch 'default' + HG: changed b + HG: removed a $ hg export tip --git # HG changeset patch # User foo @@ -114,6 +128,7 @@ Graft out of order, skipping a merge and a duplicate +(this also tests that editor is not invoked if '--edit' is not specified) $ hg graft 1 5 4 3 'merge()' 2 -n skipping ungraftable merge revision 6 @@ -123,7 +138,7 @@ grafting revision 4 grafting revision 3 - $ hg graft 1 5 4 3 'merge()' 2 --debug + $ HGEDITOR=cat hg graft 1 5 4 3 'merge()' 2 --debug skipping ungraftable merge revision 6 scanning for duplicate grafts skipping revision 2 (already grafted to 7)