# HG changeset patch # User FUJIWARA Katsunori # Date 1395158861 -32400 # Node ID 95aab23a806b8e3d45cfc63f7b895b8020ae7369 # Parent f042d4b263f47d8a2a9e37a3ca25e9bed5675a6f rebase: use "commitforceeditor" instead of "ui.edit()" for "--collapse" Before this patch, "rebase --collapse --edit" without "--message" and "--logfile" invokes editor twice unexpectedly: 1. explicit "ui.edit()" invocation in rebase extension itself 2. indirect invocation in "localrepository.commit()" with "editor = commitforceeditor" assigned by "--edit" option This patch uses indirect "commitforceeditor" invocation instead of "ui.edit()" for "--collapse" without "--message" and "--logfile" to: - suppress redundant the former invocation - ensure editor invocation even when "--edit" is not specified diff -r f042d4b263f4 -r 95aab23a806b hgext/rebase.py --- a/hgext/rebase.py Wed Mar 19 01:07:41 2014 +0900 +++ b/hgext/rebase.py Wed Mar 19 01:07:41 2014 +0900 @@ -369,7 +369,7 @@ for rebased in state: if rebased not in skipped and state[rebased] > nullmerge: commitmsg += '\n* %s' % repo[rebased].description() - commitmsg = ui.edit(commitmsg, repo.ui.username()) + editor = cmdutil.commitforceeditor newrev = concludenode(repo, rev, p1, external, commitmsg=commitmsg, extrafn=extrafn, editor=editor) for oldrev in state.iterkeys(): diff -r f042d4b263f4 -r 95aab23a806b tests/test-rebase-collapse.t --- a/tests/test-rebase-collapse.t Wed Mar 19 01:07:41 2014 +0900 +++ b/tests/test-rebase-collapse.t Wed Mar 19 01:07:41 2014 +0900 @@ -52,14 +52,39 @@ $ hg phase --force --secret 3 - $ hg rebase --collapse --keepbranches + $ cat > $TESTTMP/editor.sh < echo "==== before editing" + > cat \$1 + > echo "====" + > echo "edited manually" >> \$1 + > EOF + $ HGEDITOR="sh $TESTTMP/editor.sh" hg rebase --collapse --keepbranches -e + ==== before editing + Collapsed revision + * B + * C + * D + + + HG: Enter commit message. Lines beginning with 'HG:' are removed. + HG: Leave message empty to abort commit. + HG: -- + HG: user: Nicolas Dumazet + HG: branch 'default' + HG: changed B + HG: changed C + HG: changed D + ==== saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob) $ hg tglogp @ 5:secret 'Collapsed revision | * B | * C - | * D' + | * D + | + | + | edited manually' o 4:draft 'H' | | o 3:draft 'G'