changeset 17086:5f2cacb715dc

tests: make histedit tests more resilient to filesystem variation Better quoting of odd filesystem paths and no dependency to execute bit.
author Mads Kiilerich <mads@kiilerich.com>
date Sat, 30 Jun 2012 03:34:50 +0200
parents 35729bdd59b6
children a79776f427b4
files tests/test-histedit-commute.t tests/test-histedit-drop.t tests/test-histedit-edit.t tests/test-histedit-fold-non-commute.t tests/test-histedit-fold.t tests/test-histedit-no-change.t tests/test-histedit-non-commute-abort.t tests/test-histedit-non-commute.t
diffstat 8 files changed, 22 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-histedit-commute.t	Sat Jun 30 03:34:44 2012 +0200
+++ b/tests/test-histedit-commute.t	Sat Jun 30 03:34:50 2012 +0200
@@ -79,7 +79,7 @@
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 edit the history
-  $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
   0 files updated, 0 files merged, 3 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -134,7 +134,7 @@
   > pick b069cc29fb22 e
   > pick 26f6a030ae82 f
   > EOF
-  $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
   0 files updated, 0 files merged, 3 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -181,7 +181,7 @@
   > pick e860deea161a e
   > pick 177f92b77385 c
   > EOF
-  $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
   0 files updated, 0 files merged, 4 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -227,7 +227,7 @@
   > pick 99a62755c625 c
   > pick 7c6fdd608667 e
   > EOF
-  $ HGEDITOR="cat $EDITED > " hg histedit bfe4a5a76b37 --keep 2>&1 | fixbundle
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit bfe4a5a76b37 --keep 2>&1 | fixbundle
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-histedit-drop.t	Sat Jun 30 03:34:44 2012 +0200
+++ b/tests/test-histedit-drop.t	Sat Jun 30 03:34:50 2012 +0200
@@ -61,7 +61,7 @@
   
 
 edit the history
-  $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
   0 files updated, 0 files merged, 4 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-histedit-edit.t	Sat Jun 30 03:34:44 2012 +0200
+++ b/tests/test-histedit-edit.t	Sat Jun 30 03:34:50 2012 +0200
@@ -61,7 +61,7 @@
   
 
 edit the history
-  $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   abort: Make changes as needed, you may commit or record as needed now.
   When you are finished, run hg histedit --continue to resume.
@@ -118,7 +118,7 @@
   $ cat > $EDITED <<EOF
   > edit bf757c081cd0 f
   > EOF
-  $ HGEDITOR="cat $EDITED > " hg histedit tip 2>&1 | fixbundle
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit tip 2>&1 | fixbundle
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   abort: Make changes as needed, you may commit or record as needed now.
   When you are finished, run hg histedit --continue to resume.
@@ -139,12 +139,10 @@
 
 say we'll change the message, but don't.
   $ cat > ../edit.sh <<EOF
-  > #!/bin/sh
-  > cat \$1 | sed s/pick/mess/ > tmp
-  > mv tmp \$1
+  > cat "\$1" | sed s/pick/mess/ > tmp
+  > mv tmp "\$1"
   > EOF
-  $ chmod +x ../edit.sh
-  $ HGEDITOR="../edit.sh" hg histedit tip 2>&1 | fixbundle
+  $ HGEDITOR="sh ../edit.sh" hg histedit tip 2>&1 | fixbundle
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg status
@@ -160,7 +158,7 @@
   $ cat > $EDITED <<EOF
   > mess bf757c081cd0 f
   > EOF
-  $ HGEDITOR="cat $EDITED > " hg histedit tip 2>&1 | fixbundle
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit tip 2>&1 | fixbundle
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg status
--- a/tests/test-histedit-fold-non-commute.t	Sat Jun 30 03:34:44 2012 +0200
+++ b/tests/test-histedit-fold-non-commute.t	Sat Jun 30 03:34:50 2012 +0200
@@ -71,7 +71,7 @@
   
 
 edit the history
-  $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   1 out of 1 hunks FAILED -- saving rejects to file e.rej
   abort: Fix up the change and run hg histedit --continue
--- a/tests/test-histedit-fold.t	Sat Jun 30 03:34:44 2012 +0200
+++ b/tests/test-histedit-fold.t	Sat Jun 30 03:34:50 2012 +0200
@@ -61,7 +61,7 @@
   
 
 edit the history
-  $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
   0 files updated, 0 files merged, 4 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-histedit-no-change.t	Sat Jun 30 03:34:44 2012 +0200
+++ b/tests/test-histedit-no-change.t	Sat Jun 30 03:34:50 2012 +0200
@@ -32,12 +32,11 @@
   >     # generate an editor script for selecting changesets to be edited
   >     choice=$1  # changesets that should be edited (using sed line ranges)
   >     cat <<EOF | sed 's:^....::'
-  >     #!/bin/sh
   >     # editing the rules, replacing 'pick' with 'edit' for the chosen lines
-  >     sed '${choice}s:^pick:edit:' \$1 > \${1}.tmp
-  >     mv \${1}.tmp \$1
+  >     sed '${choice}s:^pick:edit:' "\$1" > "\${1}.tmp"
+  >     mv "\${1}.tmp" "\$1"
   >     # displaying the resulting rules, minus comments and empty lines
-  >     sed '/^#/d;/^$/d;s:^:| :' \$1 >&2
+  >     sed '/^#/d;/^$/d;s:^:| :' "\$1" >&2
   > EOF
   > }
 
@@ -48,9 +47,8 @@
   >     number="$2"  # number of changesets considered (from tip)
   >     comment="$3"
   >     geneditor "${choice}" > edit.sh
-  >     chmod +x edit.sh
   >     echo % start editing the history ${comment}
-  >     HGEDITOR=./edit.sh hg histedit -- -${number} 2>&1 | fixbundle
+  >     HGEDITOR="sh ./edit.sh" hg histedit -- -${number} 2>&1 | fixbundle
   > }
 
   $ continueediting ()
--- a/tests/test-histedit-non-commute-abort.t	Sat Jun 30 03:34:44 2012 +0200
+++ b/tests/test-histedit-non-commute-abort.t	Sat Jun 30 03:34:50 2012 +0200
@@ -71,7 +71,7 @@
   
 
 edit the history
-  $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   1 out of 1 hunks FAILED -- saving rejects to file e.rej
   abort: Fix up the change and run hg histedit --continue
--- a/tests/test-histedit-non-commute.t	Sat Jun 30 03:34:44 2012 +0200
+++ b/tests/test-histedit-non-commute.t	Sat Jun 30 03:34:50 2012 +0200
@@ -71,7 +71,7 @@
   
 
 edit the history
-  $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   1 out of 1 hunks FAILED -- saving rejects to file e.rej
   abort: Fix up the change and run hg histedit --continue
@@ -122,7 +122,7 @@
   
 
 edit the history
-  $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   1 out of 1 hunks FAILED -- saving rejects to file e.rej
   abort: Fix up the change and run hg histedit --continue
@@ -190,14 +190,14 @@
   > EOF
 
 edit the history, this time with a fold action
-  $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   1 out of 1 hunks FAILED -- saving rejects to file e.rej
   abort: Fix up the change and run hg histedit --continue
 
   $ echo a > e
   $ hg add e
-  $ HGEDITOR="cat $EDITED > " hg histedit --continue 2>&1 | fixbundle
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit --continue 2>&1 | fixbundle
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   file e already exists
   1 out of 1 hunks FAILED -- saving rejects to file e.rej