[PATCH 1 of 2] revert: change a test to make the change of direction of revert -i easier

Laurent Charignon lcharignon at fb.com
Tue Jun 23 21:38:48 UTC 2015


# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1435092418 25200
#      Tue Jun 23 13:46:58 2015 -0700
# Node ID 595e7697c6fea4b359eecfd6fb611e267ca7bb58
# Parent  2748bf78a5bf610da4f2d90fd1eea19a3b360c04
revert: change a test to make the change of direction of revert -i easier

Currently we are handling editing of newly added file with the interactive
interface. We are not handling editing of deleted file. In the test for revert
we were editing a newly added file. Since we want to change the direction of
revert -i, this editing of newly added file will before editing of deleted file.
Since we don't support that, this patch changes the test to make the rest of
the series cleaner.

diff --git a/tests/test-revert-interactive.t b/tests/test-revert-interactive.t
--- a/tests/test-revert-interactive.t
+++ b/tests/test-revert-interactive.t
@@ -282,44 +282,30 @@ 1) Create a dummy editor changing 1 to 4
   > mv tt  "$1"
   > __EOF__
 
-2) Remove f
-  $ hg rm f
-  $ hg commit -m "remove f"
+2) Add k
+  $ printf "1\n" > k
+  $ hg add k
+  $ hg commit -m "add k"
 
-3) Do another commit on top
-  $ touch k; hg add k
-  $ hg commit -m "add k"
-  $ hg st
-
-4) Use interactive revert to recover f and change it on the fly
-  $ HGEDITOR="\"sh\" \"${TESTTMP}/editor.sh\"" hg revert -i -r ".^^"  <<EOF
+3) Use interactive revert with editing (replacing +1 with +42):
+  $ printf "0\n2\n" > k
+  $ HGEDITOR="\"sh\" \"${TESTTMP}/editor.sh\"" hg revert -i  <<EOF
   > y
   > e
   > EOF
-  adding f
-  removing k
-  diff --git a/f b/f
-  new file mode 100644
-  examine changes to 'f'? [Ynesfdaq?] y
+  reverting k
+  diff --git a/k b/k
+  1 hunks, 2 lines changed
+  examine changes to 'k'? [Ynesfdaq?] y
   
-  @@ -0,0 +1,7 @@
-  +a
+  @@ -1,2 +1,1 @@
+  -0
+  -2
   +1
-  +2
-  +3
-  +4
-  +5
-  +b
-  record this change to 'f'? [Ynesfdaq?] e
+  record this change to 'k'? [Ynesfdaq?] e
   
-  $ cat f
-  a
+  $ cat k
   42
-  2
-  3
-  4
-  5
-  b
 
 Check the experimental config to invert the selection:
   $ cat <<EOF >> $HGRCPATH
@@ -332,7 +318,7 @@ Check the experimental config to invert 
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ printf 'firstline\nc\n1\n2\n3\n 3\n5\nd\nlastline\n' > folder1/g
   $ hg diff --nodates
-  diff -r 5a858e056dc0 folder1/g
+  diff -r a3d963a027aa folder1/g
   --- a/folder1/g
   +++ b/folder1/g
   @@ -1,7 +1,9 @@
@@ -383,7 +369,7 @@ Check the experimental config to invert 
   record change 3/3 to 'folder1/g'? [Ynesfdaq?] n
   
   $ hg diff --nodates
-  diff -r 5a858e056dc0 folder1/g
+  diff -r a3d963a027aa folder1/g
   --- a/folder1/g
   +++ b/folder1/g
   @@ -5,3 +5,4 @@


More information about the Mercurial-devel mailing list