Mercurial > hg-stable
changeset 21406:288a793c3167
fetch: use "getcommiteditor()" instead of explicit editor choice
This patch also enhances "test-fetch.t", because "hg fetch" hasn't
been explicitly tested around editor invocation and '--edit' option.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sun, 11 May 2014 00:49:35 +0900 |
parents | dcf20f244c2a |
children | 47bfe5d433ac |
files | hgext/fetch.py tests/test-fetch.t |
diffstat | 2 files changed, 22 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/fetch.py Sun May 11 00:49:35 2014 +0900 +++ b/hgext/fetch.py Sun May 11 00:49:35 2014 +0900 @@ -142,10 +142,9 @@ message = (cmdutil.logmessage(ui, opts) or ('Automated merge with %s' % util.removeauth(other.url()))) - editor = cmdutil.commiteditor - if opts.get('force_editor') or opts.get('edit'): - editor = cmdutil.commitforceeditor - n = repo.commit(message, opts['user'], opts['date'], editor=editor) + editopt = opts.get('edit') or opts.get('force_editor') + n = repo.commit(message, opts['user'], opts['date'], + editor=cmdutil.getcommiteditor(edit=editopt)) ui.status(_('new changeset %d:%s merges remote changes ' 'with local\n') % (repo.changelog.rev(n), short(n)))
--- a/tests/test-fetch.t Sun May 11 00:49:35 2014 +0900 +++ b/tests/test-fetch.t Sun May 11 00:49:35 2014 +0900 @@ -68,8 +68,9 @@ $ cat a/hg.pid >> "$DAEMON_PIDS" fetch over http, no auth +(this also tests that editor is invoked if '--edit' is specified) - $ hg --cwd d fetch http://localhost:$HGPORT/ + $ HGEDITOR=cat hg --cwd d fetch --edit http://localhost:$HGPORT/ pulling from http://localhost:$HGPORT/ searching for changes adding changesets @@ -80,13 +81,29 @@ 1 files updated, 0 files merged, 1 files removed, 0 files unresolved merging with 1:d36c0562f908 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + Automated merge with http://localhost:$HGPORT/ + + + HG: Enter commit message. Lines beginning with 'HG:' are removed. + HG: Leave message empty to abort commit. + HG: -- + HG: user: test + HG: branch merge + HG: branch 'default' + HG: changed c new changeset 3:* merges remote changes with local (glob) $ hg --cwd d tip --template '{desc}\n' Automated merge with http://localhost:$HGPORT/ + $ hg --cwd d status --rev 'tip^1' --rev tip + A c + $ hg --cwd d status --rev 'tip^2' --rev tip + A b fetch over http with auth (should be hidden in desc) +(this also tests that editor is not invoked if '--edit' is not +specified, even though commit message is not specified explicitly) - $ hg --cwd e fetch http://user:password@localhost:$HGPORT/ + $ HGEDITOR=cat hg --cwd e fetch http://user:password@localhost:$HGPORT/ pulling from http://user:***@localhost:$HGPORT/ searching for changes adding changesets