diff tests/test-import-bypass.t @ 21417:308aaeb956e2

import: use "getcommiteditor()" instead of explicit editor choice This patch also enhances "test-import-bypass.t" and "test-import.t", because "hg import" hasn't been explicitly tested around editor invocation and "--edit" option. This patch explicitly tests below: - with "--bypass" (regardless of "--edit"): - not invoked, if the patch contains the commit message - not invoked, if the commit message is explicitly specified - invoked, otherwise (just adding comment) - without "--bypass": - with "--edit": - not invoked, if "--no-commit" is not specified - invoked, otherwise - without "--edit": - not invoked, if the patch contains the commit message - not invoked, if "--message" or "--logfile" is specified (just adding comment) - invoked, otherwise
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sun, 11 May 2014 00:49:36 +0900
parents aa9385f983fa
children e116abad3afa
line wrap: on
line diff
--- a/tests/test-import-bypass.t	Sun May 11 00:49:36 2014 +0900
+++ b/tests/test-import-bypass.t	Sun May 11 00:49:36 2014 +0900
@@ -22,8 +22,10 @@
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
 
 Test importing an existing revision
+(this also tests that editor is not invoked for '--bypass', if the
+patch contains the commit message, regardless of '--edit')
 
-  $ hg import --bypass --exact ../test.diff
+  $ HGEDITOR=cat hg import --bypass --exact --edit ../test.diff
   applying ../test.diff
   $ shortlog
   o  1:4e322f7ce8e3 test 0 0 - foo - changea
@@ -107,6 +109,8 @@
   [255]
 
 Test commit editor
+(this also tests that editor is invoked, if the patch doesn't contain
+the commit message, regardless of '--edit')
 
   $ cat > ../test.diff <<EOF
   > diff -r 07f494440405 -r 4e322f7ce8e3 a
@@ -131,10 +135,12 @@
   [255]
 
 Test patch.eol is handled
+(this also tests that editor is not invoked for '--bypass', if the
+commit message is explicitly specified, regardless of '--edit')
 
   $ python -c 'file("a", "wb").write("a\r\n")'
   $ hg ci -m makeacrlf
-  $ hg import -m 'should fail because of eol' --bypass ../test.diff
+  $ HGEDITOR=cat hg import -m 'should fail because of eol' --edit --bypass ../test.diff
   applying ../test.diff
   patching file a
   Hunk #1 FAILED at 0