diff tests/test-record.t @ 24235:79fceed67676

record: allow editing new files (issue4304) While using the record extension to select changes, the user couldn't see the content of newly added files and had to select/reject them based on filename. The test is changed accordingly in two places.
author Laurent Charignon <lcharignon@fb.com>
date Fri, 06 Mar 2015 15:57:43 -0800
parents 486a1fe09422
children 1725843a7644
line wrap: on
line diff
--- a/tests/test-record.t	Thu Mar 05 14:42:25 2015 -0800
+++ b/tests/test-record.t	Fri Mar 06 15:57:43 2015 -0800
@@ -235,7 +235,19 @@
   new file mode 100644
   examine changes to 'plain'? [Ynesfdaq?] y
   
-
+  @@ -0,0 +1,10 @@
+  +1
+  +2
+  +3
+  +4
+  +5
+  +6
+  +7
+  +8
+  +9
+  +10
+  record this change to 'plain'? [Ynesfdaq?] y
+  
   $ hg tip -p
   changeset:   7:11fb457c1be4
   tag:         tip
@@ -317,6 +329,7 @@
   > y
   > y
   > y
+  > y
   > EOF
   diff --git a/plain b/plain
   1 hunks, 1 lines changed
@@ -335,7 +348,10 @@
   new file mode 100644
   examine changes to 'plain2'? [Ynesfdaq?] y
   
-
+  @@ -0,0 +1,1 @@
+  +1
+  record change 2/2 to 'plain2'? [Ynesfdaq?] y
+  
 Modify beginning, trim end, record both, add another file to test
 changes numbering
 
@@ -1353,6 +1369,8 @@
    c
   +d
   
+
+
 Test --user when ui.username not set
   $ unset HGUSER
   $ echo e >> subdir/f1
@@ -1376,4 +1394,41 @@
   $ HGUSER="test"
   $ export HGUSER
 
+
+Editing patch of newly added file
+
+  $ cat > editor.sh << '__EOF__'
+  > cat "$1"  | sed "s/first/very/g"  > tt
+  > mv tt  "$1"
+  > __EOF__
+  $ cat > newfile << '__EOF__'
+  > This is the first line
+  > This is the second line
+  > This is the third line
+  > __EOF__
+  $ hg add newfile
+  $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg record -d '23 0' -medit-patch-new <<EOF
+  > y
+  > e
+  > EOF
+  diff --git a/newfile b/newfile
+  new file mode 100644
+  examine changes to 'newfile'? [Ynesfdaq?] y
+  
+  @@ -0,0 +1,3 @@
+  +This is the first line
+  +This is the second line
+  +This is the third line
+  record this change to 'newfile'? [Ynesfdaq?] e
+  
+  $ hg cat -r tip newfile
+  This is the very line
+  This is the second line
+  This is the third line
+
+  $ cat newfile
+  This is the first line
+  This is the second line
+  This is the third line
+
   $ cd ..