[PATCH 3 of 8] histedit-test: replace obscure python script by a plain file

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Apr 16 14:20:32 CDT 2013


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1366138217 -7200
# Node ID c84edaaf84839ccf18c8caf4118df0ed5c9110fe
# Parent  23ef999431192b42f5a75344fd90312e4adb3e3b
histedit-test: replace obscure python script by a plain file

One of the test use a python script to change command on the fly. It was hard
to read and likely to break. This is replaced by a plain command file.

Doing so made me discover that the python script is incorrect. The "+6" regexp
never match because the revision number is wrong.

This error is kept in the replacement for now. Fixing the histedit command
trigger a traceback in histedit.

A later changeset will fix the error and restore the intended test.

diff --git a/tests/test-histedit-fold.t b/tests/test-histedit-fold.t
--- a/tests/test-histedit-fold.t
+++ b/tests/test-histedit-fold.t
@@ -97,11 +97,11 @@ check histedit_source
   $ cd ..
 
 folding and creating no new change doesn't break:
 -------------------------------------------------
 
-folded content is dropped during a merge.
+folded content is dropped during a merge. The folded commit should properly disapear.
 
   $ mkdir fold-to-empty-test
   $ cd fold-to-empty-test
   $ hg init
   $ printf "1\n2\n3\n" > file
@@ -121,31 +121,27 @@ folded content is dropped during a merge
   o  1:617f94f13c0f +4'
   |
   o  0:0189ba417d34 1+2+3'
   
 
-  $ cat > editor.py <<EOF
-  > import re, sys
-  > rules = sys.argv[1]
-  > data = open(rules).read()
-  > data = re.sub(r'pick ([0-9a-f]{12} 2 \+5)', r'drop \1', data)
-  > data = re.sub(r'pick ([0-9a-f]{12} 2 \+6)', r'fold \1', data)
-  > open(rules, 'w').write(data)
+  $ cat > $EDITED <<EOF
+  > pick 617f94f13c0f 1 +4
+  > drop 888f9082bf99 2 +5
+  > pick 251d831eeec5 3 +6
   > EOF
 
-  $ HGEDITOR='python editor.py' hg histedit 1
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 1
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   merging file
   warning: conflicts during merge.
   merging file incomplete! (edit conflicts, then use 'hg resolve --mark')
   Fix up the change and run hg histedit --continue
   [1]
 There were conflicts, we keep P1 content. This
 should effectively drop the changes from +6.
   $ hg status
   M file
-  ? editor.py
   ? file.orig
   $ hg resolve -l
   U file
   $ hg revert -r 'p1()' file
   $ hg resolve --mark file


More information about the Mercurial-devel mailing list