[PATCH STABLE] test-histedit: add tests for dropping head changeset

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Fri Jan 25 10:33:45 CST 2013


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1358861597 -3600
# Branch stable
# Node ID 4e53d143ad58d28632c60bab54bd47db6bf46744
# Parent  692cbda1eb50fe30c70792cb1e9380b28769467c
test-histedit: add tests for dropping head changeset

I got bug report from user in this specific case. I was unable to reproduce in
test situation. Testing this situation is still valuable.

diff --git a/tests/test-histedit-drop.t b/tests/test-histedit-drop.t
--- a/tests/test-histedit-drop.t
+++ b/tests/test-histedit-drop.t
@@ -121,6 +121,38 @@ manifest after edit
   b
   d
   e
   f
 
+Drop the last changeset
+
+  $ cat > $EDITED <<EOF
+  > pick ee283cb5f2d5 e
+  > pick a4f7421b80f7 f
+  > drop f518305ce889 d
+  > EOF
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit ee283cb5f2d5 2>&1 | fixbundle
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg log --graph
+  @  changeset:   3:a4f7421b80f7
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     f
+  |
+  o  changeset:   2:ee283cb5f2d5
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     e
+  |
+  o  changeset:   1:d2ae7f538514
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     b
+  |
+  o  changeset:   0:cb9a9f314b8b
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+
   $ cd ..
diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
--- a/tests/test-histedit-obsolete.t
+++ b/tests/test-histedit-obsolete.t
@@ -151,10 +151,60 @@ Test that rewriting leaving instability 
 
 stabilise
 
   $ hg rebase  -r 'unstable()' -d .
 
+Test dropping of changeset on the top of the stack
+-------------------------------------------------------
+
+Nothing is rewritten below, the working directory parent must be change for the
+dropped changeset to be hidden.
+
+  $ cd ..
+  $ hg clone base droplast
+  updating to branch default
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd droplast
+  $ cat > commands.txt <<EOF
+  > pick 40db8afa467b 10 c
+  > drop b449568bf7fc 11 f
+  > EOF
+  $ hg histedit -r '40db8afa467b' --commands commands.txt
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg log -G
+  @  10:40db8afa467b c
+  |
+  o  0:cb9a9f314b8b a
+  
+
+With rewritten ancestors
+
+  $ echo e > e
+  $ hg add e
+  $ hg commit -m g
+  $ echo f > f
+  $ hg add f
+  $ hg commit -m h
+  $ cat > commands.txt <<EOF
+  > pick 47a8561c0449 12 g
+  > pick 40db8afa467b 10 c
+  > drop 1b3b05f35ff0 13 h
+  > EOF
+  $ hg histedit -r '40db8afa467b' --commands commands.txt
+  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
+  $ hg log -G
+  @  15:ee6544123ab8 c
+  |
+  o  14:269e713e9eae g
+  |
+  o  0:cb9a9f314b8b a
+  
+  $ cd ../base
+
+
 
 Test phases support
 ===========================================
 
 Check that histedit respect immutability


More information about the Mercurial-devel mailing list