# HG changeset patch # User Pierre-Yves David # Date 1366167445 18000 # Node ID 53060cc1b6012adde7efcd7d355a8c3b81780f8b # Parent 730614b9b35291fa89221fe9d4fa0f97bcd424f6 histedit-test: generalise --commands "-" usage This is simpler than temporary file version. There some minor test changes since commit messages are no longer modifed. There is still some tests using --commands with a real file. diff -r 730614b9b352 -r 53060cc1b601 tests/test-histedit-bookmark-motion.t --- a/tests/test-histedit-bookmark-motion.t Tue Apr 16 20:48:37 2013 +0200 +++ b/tests/test-histedit-bookmark-motion.t Tue Apr 16 21:57:25 2013 -0500 @@ -76,14 +76,13 @@ # m, mess = edit message without changing commit content # 0 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ cat >> commands.txt < pick 177f92b77385 2 c > drop d2ae7f538514 1 b > pick 055a42cdd887 3 d > fold e860deea161a 4 e > pick 652413bf663e 5 f > EOF - $ hg histedit 1 --commands commands.txt --verbose | grep histedit histedit: moving bookmarks also-two from 177f92b77385 to b346ab9a313d histedit: moving bookmarks five from 652413bf663e to cacdfd884a93 histedit: moving bookmarks four from e860deea161a to 59d9f330561f @@ -135,12 +134,11 @@ # m, mess = edit message without changing commit content # 0 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ cat > commands.txt << EOF + $ hg histedit 1 --commands - --verbose << EOF | grep histedit > pick b346ab9a313d 1 c > pick cacdfd884a93 3 f > pick 59d9f330561f 2 d > EOF - $ hg histedit 1 --commands commands.txt --verbose | grep histedit histedit: moving bookmarks five from cacdfd884a93 to c04e50810e4b histedit: moving bookmarks four from 59d9f330561f to c04e50810e4b histedit: moving bookmarks three from 59d9f330561f to c04e50810e4b diff -r 730614b9b352 -r 53060cc1b601 tests/test-histedit-commute.t --- a/tests/test-histedit-commute.t Tue Apr 16 20:48:37 2013 +0200 +++ b/tests/test-histedit-commute.t Tue Apr 16 21:57:25 2013 -0500 @@ -6,13 +6,6 @@ > histedit= > EOF - $ EDITED="$TESTTMP/editedhistory" - $ cat > $EDITED < pick 177f92b77385 c - > pick e860deea161a e - > pick 652413bf663e f - > pick 055a42cdd887 d - > EOF $ initrepo () > { > hg init r @@ -79,6 +72,15 @@ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved edit the history +(use a hacky editor to check histedit-last-edit.txt backup) + + $ EDITED="$TESTTMP/editedhistory" + $ cat > $EDITED < pick 177f92b77385 c + > pick e860deea161a e + > pick 652413bf663e f + > pick 055a42cdd887 d + > EOF $ 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 @@ -128,13 +130,12 @@ put things back - $ cat > $EDITED <&1 << EOF | fixbundle > pick 177f92b77385 c > pick 07114f51870f d > pick d8249471110a e > pick 8ade9693061e f > EOF - $ 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 @@ -175,13 +176,12 @@ slightly different this time - $ cat > $EDITED <&1 | fixbundle > pick 10517e47bbbb d > pick 7eca9b5b1148 f > pick 915da888f2de e > pick 177f92b77385 c > EOF - $ 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 @@ -221,21 +221,16 @@ keep prevents stripping dead revs - $ cat > $EDITED <&1 << EOF | fixbundle > pick 799205341b6b d > pick be9ae3a309c6 f > pick 38b92f448761 c > pick de71b079d9ce e > EOF - $ HGEDITOR="cat \"$EDITED\" > " hg histedit 799205341b6b --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 $ hg log --graph - > cat > $EDITED < pick de71b079d9ce e - > pick 38b92f448761 c - > EOF @ changeset: 7:803ef1c6fcfd | tag: tip | user: test @@ -280,7 +275,10 @@ try with --rev - $ hg histedit --commands "$EDITED" --rev -2 2>&1 | fixbundle + $ hg histedit --commands - --rev -2 2>&1 < pick de71b079d9ce e + > pick 38b92f448761 c + > EOF abort: may not use changesets other than the ones listed $ hg log --graph @ changeset: 7:803ef1c6fcfd diff -r 730614b9b352 -r 53060cc1b601 tests/test-histedit-drop.t --- a/tests/test-histedit-drop.t Tue Apr 16 20:48:37 2013 +0200 +++ b/tests/test-histedit-drop.t Tue Apr 16 21:57:25 2013 -0500 @@ -6,13 +6,6 @@ > histedit= > EOF - $ EDITED="$TESTTMP/editedhistory" - $ cat > $EDITED < drop 177f92b77385 c - > pick e860deea161a e - > pick 652413bf663e f - > pick 055a42cdd887 d - > EOF $ initrepo () > { > hg init r @@ -61,7 +54,12 @@ edit the history - $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle + $ hg histedit 177f92b77385 --commands - 2>&1 << EOF | fixbundle + > drop 177f92b77385 c + > pick e860deea161a e + > pick 652413bf663e f + > pick 055a42cdd887 d + > EOF 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 @@ -125,12 +123,11 @@ Drop the last changeset - $ cat > $EDITED <&1 << EOF | fixbundle > 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 diff -r 730614b9b352 -r 53060cc1b601 tests/test-histedit-edit.t --- a/tests/test-histedit-edit.t Tue Apr 16 20:48:37 2013 +0200 +++ b/tests/test-histedit-edit.t Tue Apr 16 21:57:25 2013 -0500 @@ -6,13 +6,6 @@ > histedit= > EOF - $ EDITED="$TESTTMP/editedhistory" - $ cat > $EDITED < pick 177f92b77385 c - > pick 055a42cdd887 d - > edit e860deea161a e - > pick 652413bf663e f - > EOF $ initrepo () > { > hg init r @@ -61,7 +54,12 @@ edit the history - $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle + $ hg histedit 177f92b77385 --commands - 2>&1 << EOF| fixbundle + > pick 177f92b77385 c + > pick 055a42cdd887 d + > edit e860deea161a e + > pick 652413bf663e f + > EOF 0 files updated, 0 files merged, 2 files removed, 0 files unresolved Make changes as needed, you may commit or record as needed now. When you are finished, run hg histedit --continue to resume. @@ -146,10 +144,9 @@ - $ cat > $EDITED <&1 < edit b5f70786f9b0 f > EOF - $ HGEDITOR="cat \"$EDITED\" > " hg histedit tip 2>&1 | fixbundle 0 files updated, 0 files merged, 1 files removed, 0 files unresolved Make changes as needed, you may commit or record as needed now. When you are finished, run hg histedit --continue to resume. @@ -188,19 +185,18 @@ modify the message - $ cat > $EDITED <&1 << EOF | fixbundle > mess 1fd3b2fe7754 f > EOF - $ 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 $ hg log --limit 1 - changeset: 6:5585e802ef99 + changeset: 6:62feedb1200e tag: tip user: test date: Thu Jan 01 00:00:00 1970 +0000 - summary: mess 1fd3b2fe7754 f + summary: f rollback should not work after a histedit @@ -211,9 +207,10 @@ $ cd .. $ hg clone -qr0 r r0 $ cd r0 - $ echo edit cb9a9f314b8b a > $EDITED $ hg phase -fdr0 - $ HGEDITOR="cat \"$EDITED\" > " hg histedit 0 2>&1 + $ hg histedit --commands - 0 2>&1 << EOF + > edit cb9a9f314b8b a > $EDITED + > EOF 0 files updated, 0 files merged, 1 files removed, 0 files unresolved adding a Make changes as needed, you may commit or record as needed now. diff -r 730614b9b352 -r 53060cc1b601 tests/test-histedit-fold-non-commute.t --- a/tests/test-histedit-fold-non-commute.t Tue Apr 16 20:48:37 2013 +0200 +++ b/tests/test-histedit-fold-non-commute.t Tue Apr 16 21:57:25 2013 -0500 @@ -86,7 +86,7 @@ edit the history - $ HGEDITOR="cat \"$EDITED\" > " hg histedit 3 2>&1 | fixbundle + $ hg histedit 3 --commands $EDITED 2>&1 | fixbundle 2 files updated, 0 files merged, 0 files removed, 0 files unresolved merging e warning: conflicts during merge. diff -r 730614b9b352 -r 53060cc1b601 tests/test-histedit-fold.t --- a/tests/test-histedit-fold.t Tue Apr 16 20:48:37 2013 +0200 +++ b/tests/test-histedit-fold.t Tue Apr 16 21:57:25 2013 -0500 @@ -89,7 +89,7 @@ check histedit_source $ hg log --debug --rev 3 - changeset: 3:5e24935bad3d5a4486de3b90f233e991465ced72 + changeset: 3:6de59d13424a8a13acd3e975514aed29dd0d9b2d phase: draft parent: 2:ee283cb5f2d5955443f23a27b697a04339e9a39a parent: -1:0000000000000000000000000000000000000000 @@ -100,10 +100,9 @@ extra: branch=default extra: histedit_source=a4f7421b80f79fcc59fff01bcbf4a53d127dd6d3,177f92b773850b59254aa5e923436f921b55483b description: - pick e860deea161a e - pick 652413bf663e f - fold 177f92b77385 c - pick 055a42cdd887 d + f + *** + c @@ -136,14 +135,11 @@ o 0:0189ba417d34 1+2+3 - $ EDITED="$TESTTMP/editedhistory" - $ cat > $EDITED < pick 617f94f13c0f 1 +4 > drop 888f9082bf99 2 +5 > fold 251d831eeec5 3 +6 > EOF - - $ HGEDITOR="cat \"$EDITED\" > " hg histedit 1 1 files updated, 0 files merged, 0 files removed, 0 files unresolved merging file warning: conflicts during merge. @@ -199,13 +195,11 @@ | o 0:0189ba417d34 1+2+3 - $ EDITED="$TESTTMP/editcommands" - $ cat > $EDITED < pick 617f94f13c0f 1 +4 > drop 888f9082bf99 2 +5 > fold 251d831eeec5 3 +6 > EOF - $ HGEDITOR="cat $EDITED >" hg histedit 1 1 files updated, 0 files merged, 0 files removed, 0 files unresolved merging file warning: conflicts during merge. diff -r 730614b9b352 -r 53060cc1b601 tests/test-histedit-non-commute-abort.t --- a/tests/test-histedit-non-commute-abort.t Tue Apr 16 20:48:37 2013 +0200 +++ b/tests/test-histedit-non-commute-abort.t Tue Apr 16 21:57:25 2013 -0500 @@ -6,14 +6,6 @@ > histedit= > EOF - $ EDITED="$TESTTMP/editedhistory" - $ cat > $EDITED < pick 177f92b77385 c - > pick 055a42cdd887 d - > pick bfa474341cc9 does not commute with e - > pick e860deea161a e - > pick 652413bf663e f - > EOF $ initrepo () > { > hg init r @@ -71,7 +63,13 @@ edit the history - $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle + $ hg histedit 177f92b77385 --commands - 2>&1 < pick 177f92b77385 c + > pick 055a42cdd887 d + > pick bfa474341cc9 does not commute with e + > pick e860deea161a e + > pick 652413bf663e f + > EOF 0 files updated, 0 files merged, 2 files removed, 0 files unresolved remote changed e which local deleted use (c)hanged version or leave (d)eleted? c diff -r 730614b9b352 -r 53060cc1b601 tests/test-histedit-non-commute.t --- a/tests/test-histedit-non-commute.t Tue Apr 16 20:48:37 2013 +0200 +++ b/tests/test-histedit-non-commute.t Tue Apr 16 21:57:25 2013 -0500 @@ -87,7 +87,7 @@ edit the history - $ HGEDITOR="cat \"$EDITED\" > " hg histedit 3 2>&1 | fixbundle + $ hg histedit 3 --commands $EDITED 2>&1 | fixbundle 2 files updated, 0 files merged, 0 files removed, 0 files unresolved merging e warning: conflicts during merge. @@ -145,7 +145,7 @@ edit the history - $ HGEDITOR="cat \"$EDITED\" > " hg histedit 3 2>&1 | fixbundle + $ hg histedit 3 --commands $EDITED 2>&1 | fixbundle 2 files updated, 0 files merged, 0 files removed, 0 files unresolved merging e warning: conflicts during merge. @@ -231,7 +231,7 @@ pick 500cac37a696 6 f edit the history, this time with a fold action - $ HGEDITOR="cat \"$EDITED\" > " hg histedit 3 2>&1 | fixbundle + $ hg histedit 3 --commands $EDITED 2>&1 | fixbundle 2 files updated, 0 files merged, 0 files removed, 0 files unresolved merging e warning: conflicts during merge. @@ -240,7 +240,7 @@ $ echo 'I can haz no commute' > e $ hg resolve --mark e - $ HGEDITOR="cat \"$EDITED\" > " hg histedit --continue 2>&1 | fixbundle + $ hg histedit --commands $EDITED --continue 2>&1 | fixbundle 0 files updated, 0 files merged, 0 files removed, 0 files unresolved merging e warning: conflicts during merge. @@ -255,16 +255,16 @@ post message fix $ hg log --graph - @ changeset: 6:521c4c32c5e2 + @ changeset: 6:7efe1373e4bc | tag: tip | user: test | date: Thu Jan 01 00:00:00 1970 +0000 | summary: f | - o changeset: 5:f4f088e8adf6 + o changeset: 5:e334d87a1e55 | user: test | date: Thu Jan 01 00:00:00 1970 +0000 - | summary: pick 65a9a84f33fd 3 c + | summary: does not commute with e | o changeset: 4:00f1c5383965 | user: test diff -r 730614b9b352 -r 53060cc1b601 tests/test-histedit-obsolete.t --- a/tests/test-histedit-obsolete.t Tue Apr 16 20:48:37 2013 +0200 +++ b/tests/test-histedit-obsolete.t Tue Apr 16 21:57:25 2013 -0500 @@ -59,14 +59,13 @@ # m, mess = edit message without changing commit content # 0 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ cat > commands.txt < pick 177f92b77385 2 c > drop d2ae7f538514 1 b > pick 055a42cdd887 3 d > fold e860deea161a 4 e > pick 652413bf663e 5 f > EOF - $ hg histedit 1 --commands commands.txt --verbose | grep histedit saved backup bundle to $TESTTMP/base/.hg/strip-backup/96e494a2d553-backup.hg (glob) $ hg log --graph --hidden @ 8:cacdfd884a93 f @@ -100,12 +99,11 @@ create an hidden revision - $ cat > commands.txt < pick b346ab9a313d 6 c > drop 59d9f330561f 7 d > pick cacdfd884a93 8 f > EOF - $ hg histedit 6 --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 $ hg log --graph @@ -117,11 +115,10 @@ check hidden revision are ignored (6 have hidden children 7 and 8) - $ cat > commands.txt < pick b346ab9a313d 6 c > pick c13eb81022ca 8 f > EOF - $ hg histedit 6 --commands commands.txt 0 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -133,10 +130,9 @@ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ hg log -r 'children(.)' 9:c13eb81022ca f (no-eol) - $ cat > commands.txt < edit b346ab9a313d 6 c > EOF - $ hg histedit -r '.' --commands commands.txt 0 files updated, 0 files merged, 1 files removed, 0 files unresolved adding c Make changes as needed, you may commit or record as needed now. @@ -164,11 +160,10 @@ updating to branch default 3 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd droplast - $ cat > commands.txt < 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 @@ -184,12 +179,11 @@ $ echo f > f $ hg add f $ hg commit -m h - $ cat > commands.txt < 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 @@ -267,7 +261,7 @@ $ cp -r base simple-draft $ cd simple-draft - $ cat > commands.txt < edit b449568bf7fc 11 f > pick 6b70183d2492 12 g > pick 7395e1ff83bd 13 h @@ -275,7 +269,6 @@ > pick 3a6c53ee7f3d 15 j > pick ee118ab9fa44 16 k > EOF - $ hg histedit -r 'b449568bf7fc' --commands commands.txt 0 files updated, 0 files merged, 6 files removed, 0 files unresolved adding f Make changes as needed, you may commit or record as needed now. @@ -317,7 +310,7 @@ > [phases] > new-commit=secret > EOF - $ cat > commands.txt < edit b449568bf7fc 11 f > pick 6b70183d2492 12 g > pick 7395e1ff83bd 13 h @@ -325,7 +318,6 @@ > pick 3a6c53ee7f3d 15 j > pick ee118ab9fa44 16 k > EOF - $ hg histedit -r 'b449568bf7fc' --commands commands.txt 0 files updated, 0 files merged, 6 files removed, 0 files unresolved adding f Make changes as needed, you may commit or record as needed now. @@ -367,7 +359,7 @@ $ cp -r base reorder $ cd reorder - $ cat > commands.txt < pick b449568bf7fc 11 f > pick 3a6c53ee7f3d 15 j > pick 6b70183d2492 12 g @@ -375,7 +367,6 @@ > pick 7395e1ff83bd 13 h > pick ee118ab9fa44 16 k > EOF - $ hg histedit -r 'b449568bf7fc' --commands commands.txt 0 files updated, 0 files merged, 5 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 @@ -415,7 +406,7 @@ > [phases] > new-commit=secret > EOF - $ cat > commands.txt < pick 7395e1ff83bd 13 h > fold b449568bf7fc 11 f > pick 6b70183d2492 12 g @@ -423,7 +414,6 @@ > pick b605fb7503f2 14 i > fold ee118ab9fa44 16 k > EOF - $ hg histedit -r 'b449568bf7fc' --commands commands.txt 0 files updated, 0 files merged, 6 files removed, 0 files unresolved 0 files updated, 0 files merged, 0 files removed, 0 files unresolved 0 files updated, 0 files merged, 2 files removed, 0 files unresolved