[PATCH 2 of 3 v2] tests: use histedit helpers

Augie Fackler raf at durin42.com
Tue Mar 1 19:16:32 UTC 2016


On Mon, Feb 29, 2016 at 05:32:19PM -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless at mozdev.org>
> # Date 1456782735 0
> #      Mon Feb 29 21:52:15 2016 +0000
> # Node ID 703b2fda125bacd54b4b6b6fb78e51de507a58cb
> # Parent  5813e7cbfa39384f0fb0dd190207665af4087afc
> tests: use histedit helpers
>
> Reduce reliance on changeset hashes
>
> diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t
> --- a/tests/test-histedit-arguments.t
> +++ b/tests/test-histedit-arguments.t
> @@ -1,6 +1,7 @@
>  Test argument handling and various data parsing
>  ==================================================
>
> +  $ . "$TESTDIR/histedit-helpers.sh"
>
>  Enable extensions used by this test.
>    $ cat >>$HGRCPATH <<EOF
> @@ -87,27 +88,27 @@
>  Test that we pick the minimum of a revrange
>  ---------------------------------------
>
> -  $ HGEDITOR=cat hg histedit '2::' --commands - << EOF
> -  > pick eb57da33312f 2 three
> -  > pick c8e68270e35a 3 four
> -  > pick 08d98a8350f3 4 five
> -  > EOF
> +  $ plan
> +  $ pick 'desc(three)'
> +  $ pick 'desc(four)'
> +  $ pick 'desc(five)'

Hm. Your heart is in the right place, but I'm not crazy about the
specific implementation. We've talked about /having/ limited
undocumented revset support in histedit - would you be interested in
doing that work and then moving most (but not all, as we still need
some tests that use hashes explicitly) of the tests to that without
the helpers?

As an alternative, I'd be interested in some sort of plan filter
helper, that did something like:

while read line ; do
  action=`cut -d' ' -f 1 $line`
  revset=`cut -d' ' -f 2 $line`
  revsision=`hg log -r "$revset" --template '{node}'`
  echo $action $revision
done

That is, write a filter that does revset->hash transformation on a
flat file, rather than having this stateful-shell-function-helper
shenanigans. What do you think?

> +  $ HGEDITOR=cat hg histedit '2::' --commands $PLAN
>    $ hg up --quiet
>
> -  $ HGEDITOR=cat hg histedit 'tip:2' --commands - << EOF
> -  > pick eb57da33312f 2 three
> -  > pick c8e68270e35a 3 four
> -  > pick 08d98a8350f3 4 five
> -  > EOF
> +  $ plan
> +  $ pick 'desc(three)'
> +  $ pick 'desc(four)'
> +  $ pick 'desc(five)'
> +  $ cat $PLAN | HGEDITOR=cat hg histedit 'tip:2' --commands -
>    $ hg up --quiet
>
>  Test config specified default
>  -----------------------------
>
> -  $ HGEDITOR=cat hg histedit --config "histedit.defaultrev=only(.) - ::eb57da33312f" --commands - << EOF
> -  > pick c8e68270e35a 3 four
> -  > pick 08d98a8350f3 4 five
> -  > EOF
> +  $ plan
> +  $ pick 'desc(four)'
> +  $ pick 'desc(five)'
> +  $ HGEDITOR=cat hg histedit --config "histedit.defaultrev=only(.) - ::eb57da33312f" --commands $PLAN
>
>  Run on a revision not descendants of the initial parent
>  --------------------------------------------------------------------
> @@ -124,9 +125,9 @@
>    |
>    o  2 eb57 three
>    |
> -  $ HGEDITOR=cat hg histedit -r 4 --commands - << EOF
> -  > edit 08d98a8350f3 4 five
> -  > EOF
> +  $ plan
> +  $ edit 'desc(five)'
> +  $ HGEDITOR=cat hg histedit -r 4 --commands $PLAN
>    1 files updated, 0 files merged, 0 files removed, 0 files unresolved
>    reverting alpha
>    Editing (08d98a8350f3), you may commit or record as needed now.
> @@ -160,10 +161,10 @@
>  Test that missing revisions are detected
>  ---------------------------------------
>
> -  $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF
> -  > pick eb57da33312f 2 three
> -  > pick 08d98a8350f3 4 five
> -  > EOF
> +  $ plan
> +  $ pick 'desc(three)'
> +  $ pick 'desc(five)'
> +  $ HGEDITOR=cat hg histedit "tip^^" --commands $PLAN
>    hg: parse error: missing rules for changeset c8e68270e35a
>    (use "drop c8e68270e35a" to discard, see also: "hg help -e histedit.config")
>    [255]
> @@ -171,11 +172,11 @@
>  Test that extra revisions are detected
>  ---------------------------------------
>
> -  $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF
> -  > pick 6058cbb6cfd7 0 one
> -  > pick c8e68270e35a 3 four
> -  > pick 08d98a8350f3 4 five
> -  > EOF
> +  $ plan
> +  $ pick 'desc(one)'
> +  $ pick 'desc(four)'
> +  $ pick 'desc(five)'
> +  $ HGEDITOR=cat hg histedit "tip^^" --commands $PLAN
>    hg: parse error: pick "6058cbb6cfd7" changeset was not a candidate
>    (only use listed changesets)
>    [255]
> @@ -183,33 +184,33 @@
>  Test malformed line
>  ---------------------------------------
>
> -  $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF
> -  > pickeb57da33312f2three
> -  > pick c8e68270e35a 3 four
> -  > pick 08d98a8350f3 4 five
> -  > EOF
> +  $ plan
> +  $ echo pickeb57da33312f2three >> $PLAN
> +  $ pick 'desc(four)'
> +  $ pick 'desc(five)'
> +  $ HGEDITOR=cat hg histedit "tip^^" --commands $PLAN
>    hg: parse error: malformed line "pickeb57da33312f2three"
>    [255]
>
>  Test unknown changeset
>  ---------------------------------------
>
> -  $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF
> -  > pick 0123456789ab 2 three
> -  > pick c8e68270e35a 3 four
> -  > pick 08d98a8350f3 4 five
> -  > EOF
> +  $ plan
> +  $ echo pick 0123456789ab 2 three >> $PLAN
> +  $ pick 'desc(four)'
> +  $ pick 'desc(five)'
> +  $ HGEDITOR=cat hg histedit "tip^^" --commands $PLAN
>    hg: parse error: unknown changeset 0123456789ab listed
>    [255]
>
>  Test unknown command
>  ---------------------------------------
>
> -  $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF
> -  > coin eb57da33312f 2 three
> -  > pick c8e68270e35a 3 four
> -  > pick 08d98a8350f3 4 five
> -  > EOF
> +  $ plan
> +  $ echo coin eb57da33312f 2 three >> $PLAN
> +  $ pick 'desc(four)'
> +  $ pick 'desc(five)'
> +  $ HGEDITOR=cat hg histedit "tip^^" --commands $PLAN
>    hg: parse error: unknown action "coin"
>    [255]
>
> @@ -218,22 +219,22 @@
>
>  So one is missing and one appear twice.
>
> -  $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF
> -  > pick eb57da33312f 2 three
> -  > pick eb57da33312f 2 three
> -  > pick 08d98a8350f3 4 five
> -  > EOF
> +  $ plan
> +  $ pick 'desc(three)'
> +  $ pick 'desc(three)'
> +  $ pick 'desc(five)'
> +  $ HGEDITOR=cat hg histedit "tip^^" --commands $PLAN
>    hg: parse error: duplicated command for changeset eb57da33312f
>    [255]
>
>  Test bogus rev
>  ---------------------------------------
>
> -  $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF
> -  > pick eb57da33312f 2 three
> -  > pick 0
> -  > pick 08d98a8350f3 4 five
> -  > EOF
> +  $ plan
> +  $ pick 'desc(three)'
> +  $ echo pick 0 >> $PLAN
> +  $ pick 'desc(five)'
> +  $ HGEDITOR=cat hg histedit "tip^^" --commands $PLAN
>    hg: parse error: invalid changeset 0
>    [255]
>
> @@ -243,11 +244,11 @@
>  Note: we use varying amounts of white space between command name and changeset
>  short hash. This tests issue3893.
>
> -  $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF
> -  > pick eb57da33312f 2 three
> -  > p    c8e68270e35a 3 four
> -  > f 08d98a8350f3 4 five
> -  > EOF
> +  $ plan
> +  $ pick 'desc(three)'
> +  $ echo p    c8e68270e35a 3 four >> $PLAN
> +  $ echo f 08d98a8350f3 4 five >> $PLAN
> +  $ HGEDITOR=cat hg histedit "tip^^" --commands $PLAN
>    four
>    ***
>    five
> @@ -308,10 +309,10 @@
>  Test --continue with --keep
>
>    $ hg strip -q -r . --config extensions.strip=
> -  $ hg histedit '.^' -q --keep --commands - << EOF
> -  > edit eb57da33312f 2 three
> -  > pick f3cfcca30c44 4 x
> -  > EOF
> +  $ plan
> +  $ edit 'desc(three)'
> +  $ pick 'desc(x)'
> +  $ hg histedit '.^' -q --keep --commands $PLAN
>    Editing (eb57da33312f), you may commit or record as needed now.
>    (hg histedit --continue to resume)
>    [1]
> @@ -336,9 +337,9 @@
>
>  Test that abort fails gracefully on exception
>  ----------------------------------------------
> -  $ hg histedit . -q --commands - << EOF
> -  > edit 8fda0c726bf2 6 x
> -  > EOF
> +  $ plan
> +  $ edit 'desc(x)'
> +  $ hg histedit . -q --commands $PLAN
>    Editing (8fda0c726bf2), you may commit or record as needed now.
>    (hg histedit --continue to resume)
>    [1]
> @@ -430,23 +431,23 @@
>  Default base revision should stop at public changesets
>
>    $ hg -q up 8cdc02b9bc63
> -  $ hg histedit --commands - <<EOF
> -  > pick 463b8c0d2973
> -  > pick 8cdc02b9bc63
> -  > EOF
> +  $ plan
> +  $ pick 4
> +  $ pick 5
> +  $ hg histedit --commands $PLAN
>
>  Default base revision should stop at branchpoint
>
>    $ hg -q up 4c35cdf97d5e
> -  $ hg histedit --commands - <<EOF
> -  > pick 931820154288
> -  > pick 4c35cdf97d5e
> -  > EOF
> +  $ plan
> +  $ pick 6
> +  $ pick 7
> +  $ hg histedit --commands $PLAN
>
>  Default base revision should stop at merge commit
>
>    $ hg -q up 8cde254db839
> -  $ hg histedit --commands - <<EOF
> -  > pick 6f2f0241f119
> -  > pick 8cde254db839
> -  > EOF
> +  $ plan
> +  $ pick 11
> +  $ pick 12
> +  $ hg histedit --commands $PLAN
> diff --git a/tests/test-histedit-base.t b/tests/test-histedit-base.t
> --- a/tests/test-histedit-base.t
> +++ b/tests/test-histedit-base.t
> @@ -48,12 +48,12 @@
>
>
>  Rebase B onto H
> -  $ hg histedit 1 --commands - 2>&1 << EOF | fixbundle
> -  > base 02de42196ebe
> -  > pick 42ccdea3bb16 B
> -  > pick 5fddd98957c8 C
> -  > pick 32af7686d403 D
> -  > EOF
> +  $ plan
> +  $ base 'desc(H)'
> +  $ pick 'desc(B)'
> +  $ pick 'desc(C)'
> +  $ pick 'desc(D)'
> +  $ hg histedit 'desc(B)' --commands $PLAN 2>&1 | fixbundle
>
>    $ hg tglog
>    @  7:0937e82309df47d14176ee15e45dbec5fbdef340:draft 'D'
> @@ -73,12 +73,12 @@
>    o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
>
>  Rebase back and drop something
> -  $ hg histedit 5 --commands - 2>&1 << EOF | fixbundle
> -  > base cd010b8cd998
> -  > pick 3d41b7cc7085 B
> -  > drop f778d1cbddac C
> -  > pick 0937e82309df D
> -  > EOF
> +  $ plan
> +  $ base 'desc(A)'
> +  $ pick 'desc(B)'
> +  $ drop 'desc(C)'
> +  $ pick 'desc(D)'
> +  $ hg histedit 'desc(B)' --commands $PLAN 2>&1 | fixbundle
>
>    $ hg tglog
>    @  6:476cc3e4168da2d036b141f7f7dcff7f8e3fe846:draft 'D'
> @@ -96,12 +96,12 @@
>    o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
>
>  Split stack
> -  $ hg histedit 5 --commands - 2>&1 << EOF | fixbundle
> -  > base cd010b8cd998
> -  > pick d273e35dcdf2 B
> -  > base cd010b8cd998
> -  > pick 476cc3e4168d D
> -  > EOF
> +  $ plan
> +  $ base 'desc(A)'
> +  $ pick 'desc(B)'
> +  $ base 'desc(A)'
> +  $ pick 'desc(D)'
> +  $ hg histedit 'desc(B)' --commands $PLAN 2>&1 | fixbundle
>
>    $ hg tglog
>    @  6:d7a6f907a822c4ce6f15662ae45a42aa46d3818a:draft 'D'
> @@ -139,11 +139,11 @@
>    |/
>    o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
>
> -  $ hg histedit 6 --commands - 2>&1 << EOF | fixbundle
> -  > base d273e35dcdf2 B
> -  > drop d7a6f907a822 D
> -  > pick 591369deedfd X
> -  > EOF
> +  $ plan
> +  $ base 'desc(B)'
> +  $ drop 'desc(D)'
> +  $ pick 'desc(X)'
> +  $ hg histedit 'desc(D)' --commands $PLAN 2>&1 | fixbundle
>    merging B
>    warning: conflicts while merging B! (edit, then use 'hg resolve --mark')
>    Fix up the change (pick 591369deedfd)
> @@ -168,11 +168,11 @@
>    o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
>
>  Continue
> -  $ hg histedit 6 --commands - 2>&1 << EOF | fixbundle
> -  > base d273e35dcdf2 B
> -  > drop d7a6f907a822 D
> -  > pick 591369deedfd X
> -  > EOF
> +  $ plan
> +  $ base 'desc(B)'
> +  $ drop 'desc(D)'
> +  $ pick 'desc(X)'
> +  $ hg histedit 'desc(D)' --commands $PLAN 2>&1 | fixbundle
>    merging B
>    warning: conflicts while merging B! (edit, then use 'hg resolve --mark')
>    Fix up the change (pick 591369deedfd)
> @@ -224,24 +224,24 @@
>    |/
>    o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
>
> -  $ hg histedit 5 --commands - 2>&1 << EOF | fixbundle
> -  > pick d273e35dcdf2 B
> -  > pick 03772da75548 X
> -  > base d273e35dcdf2 B
> -  > pick e8c55b19d366 J
> -  > base d273e35dcdf2 B
> -  > pick b2f90fd8aa85 I
> -  > EOF
> +  $ plan
> +  $ pick 'desc(B)'
> +  $ pick 'desc(X)'
> +  $ base 'desc(B)'
> +  $ pick 'desc(J)'
> +  $ base 'desc(B)'
> +  $ pick 'desc(I)'
> +  $ hg histedit 'desc(B)' --commands $PLAN 2>&1 | fixbundle
>    hg: parse error: base "d273e35dcdf2" changeset was not an edited list candidate
>    (only use listed changesets)
>
> -  $ hg --config experimental.histeditng=False histedit 5 --commands - 2>&1 << EOF | fixbundle
> -  > base cd010b8cd998 A
> -  > pick d273e35dcdf2 B
> -  > pick 03772da75548 X
> -  > pick b2f90fd8aa85 I
> -  > pick e8c55b19d366 J
> -  > EOF
> +  $ plan
> +  $ base 'desc(A)'
> +  $ pick 'desc(B)'
> +  $ pick 'desc(X)'
> +  $ pick 'desc(I)'
> +  $ pick 'desc(J)'
> +  $ hg --config experimental.histeditng=False histedit 'desc(B)' --commands $PLAN 2>&1 | fixbundle
>    hg: parse error: unknown action "base"
>
>    $ hg tglog
> diff --git a/tests/test-histedit-bookmark-motion.t b/tests/test-histedit-bookmark-motion.t
> --- a/tests/test-histedit-bookmark-motion.t
> +++ b/tests/test-histedit-bookmark-motion.t
> @@ -78,13 +78,13 @@
>    #  f, fold = use commit, but combine it with the one above
>    #  r, roll = like fold, but discard this commit's description
>    #
> -  $ hg histedit 1 --commands - --verbose << EOF | grep histedit
> -  > pick 177f92b77385 2 c
> -  > drop d2ae7f538514 1 b
> -  > pick 055a42cdd887 3 d
> -  > fold e860deea161a 4 e
> -  > pick 652413bf663e 5 f
> -  > EOF
> +  $ plan
> +  $ pick 'desc(c)'
> +  $ drop 'desc(b)'
> +  $ pick 'desc(d)'
> +  $ fold 'desc(e)'
> +  $ pick 'desc(f)'
> +  $ hg histedit 1 --commands $PLAN --verbose | grep histedit
>    saved backup bundle to $TESTTMP/r/.hg/strip-backup/96e494a2d553-3c6c5d92-backup.hg (glob)
>    histedit: moving bookmarks also-two from 177f92b77385 to b346ab9a313d
>    histedit: moving bookmarks five from 652413bf663e to cacdfd884a93
> @@ -139,11 +139,11 @@
>    #  f, fold = use commit, but combine it with the one above
>    #  r, roll = like fold, but discard this commit's description
>    #
> -  $ hg histedit 1 --commands - --verbose << EOF | grep histedit
> -  > pick b346ab9a313d 1 c
> -  > pick cacdfd884a93 3 f
> -  > pick 59d9f330561f 2 d
> -  > EOF
> +  $ plan
> +  $ pick 'desc(c)'
> +  $ pick 'desc(f)'
> +  $ pick 'desc(d)'
> +  $ hg histedit 1 --commands $PLAN --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 --git a/tests/test-histedit-commute.t b/tests/test-histedit-commute.t
> --- a/tests/test-histedit-commute.t
> +++ b/tests/test-histedit-commute.t
> @@ -141,12 +141,12 @@
>
>  put things back
>
> -  $ hg histedit 177f92b77385 --commands - 2>&1 << EOF | fixbundle
> -  > pick 177f92b77385 c
> -  > pick 07114f51870f d
> -  > pick d8249471110a e
> -  > pick 8ade9693061e f
> -  > EOF
> +  $ plan
> +  $ pick 'desc(c)'
> +  $ pick 'desc(d)'
> +  $ pick 'desc(e)'
> +  $ pick 'desc(f)'
> +  $ hg histedit 'desc(c)' --commands $PLAN 2>&1 | fixbundle
>
>    $ hg log --graph
>    @  changeset:   5:7eca9b5b1148
> @@ -183,12 +183,12 @@
>
>  slightly different this time
>
> -  $ hg histedit 177f92b77385 --commands - << EOF 2>&1 | fixbundle
> -  > pick 10517e47bbbb d
> -  > pick 7eca9b5b1148 f
> -  > pick 915da888f2de e
> -  > pick 177f92b77385 c
> -  > EOF
> +  $ plan
> +  $ pick 'desc(d)'
> +  $ pick 'desc(f)'
> +  $ pick 'desc(e)'
> +  $ pick 'desc(c)'
> +  $ hg histedit 'desc(c)' --commands $PLAN  2>&1 | fixbundle
>    $ hg log --graph
>    @  changeset:   5:38b92f448761
>    |  tag:         tip
> @@ -223,12 +223,12 @@
>
>
>  keep prevents stripping dead revs
> -  $ hg histedit 799205341b6b --keep --commands - 2>&1 << EOF | fixbundle
> -  > pick 799205341b6b d
> -  > pick be9ae3a309c6 f
> -  > pick 38b92f448761 c
> -  > pick de71b079d9ce e
> -  > EOF
> +  $ plan
> +  $ pick 'desc(d)'
> +  $ pick 'desc(f)'
> +  $ pick 'desc(c)'
> +  $ pick 'desc(e)'
> +  $ hg histedit 'desc(d)' --keep --commands $PLAN 2>&1 | fixbundle
>    $ hg log --graph
>    @  changeset:   7:803ef1c6fcfd
>    |  tag:         tip
> @@ -274,10 +274,10 @@
>
>
>  try with --rev
> -  $ hg histedit --commands - --rev -2 2>&1 <<EOF | fixbundle
> -  > pick de71b079d9ce e
> -  > pick 38b92f448761 c
> -  > EOF
> +  $ plan
> +  $ pick 4
> +  $ pick 5
> +  $ hg histedit --commands $PLAN --rev -2 2>&1 | fixbundle
>    hg: parse error: pick "de71b079d9ce" changeset was not a candidate
>    (only use listed changesets)
>    $ hg log --graph
> 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
> @@ -53,12 +53,12 @@
>
>
>  edit the history
> -  $ hg histedit 177f92b77385 --commands - 2>&1 << EOF | fixbundle
> -  > drop 177f92b77385 c
> -  > pick e860deea161a e
> -  > pick 652413bf663e f
> -  > pick 055a42cdd887 d
> -  > EOF
> +  $ plan
> +  $ drop 'desc(c)'
> +  $ pick 'desc(e)'
> +  $ pick 'desc(f)'
> +  $ pick 'desc(d)'
> +  $ hg histedit -r 2 --commands $PLAN 2>&1 | fixbundle
>
>  log after edit
>    $ hg log --graph
> @@ -118,11 +118,11 @@
>
>  Drop the last changeset
>
> -  $ hg histedit ee283cb5f2d5 --commands - 2>&1 << EOF | fixbundle
> -  > pick ee283cb5f2d5 e
> -  > pick a4f7421b80f7 f
> -  > drop f518305ce889 d
> -  > EOF
> +  $ plan
> +  $ pick 'desc(e)'
> +  $ pick 'desc(f)'
> +  $ drop 'desc(d)'
> +  $ hg histedit -r 2 --commands $PLAN 2>&1 | fixbundle
>    $ hg log --graph
>    @  changeset:   3:a4f7421b80f7
>    |  tag:         tip
> @@ -146,16 +146,16 @@
>       summary:     a
>
>
> -  $ hg histedit cb9a9f314b8b --commands - 2>&1 << EOF | fixbundle
> -  > pick cb9a9f314b8b a
> -  > pick ee283cb5f2d5 e
> -  > EOF
> +  $ plan
> +  $ pick 'desc(a)'
> +  $ pick 'desc(e)'
> +  $ hg histedit -r 0 --commands $PLAN 2>&1 | fixbundle
>    hg: parse error: missing rules for changeset a4f7421b80f7
>    (use "drop a4f7421b80f7" to discard, see also: "hg help -e histedit.config")
> -  $ hg --config histedit.dropmissing=True histedit  cb9a9f314b8b --commands - 2>&1 << EOF | fixbundle
> -  > pick cb9a9f314b8b a
> -  > pick ee283cb5f2d5 e
> -  > EOF
> +  $ plan
> +  $ pick 'desc(a)'
> +  $ pick 'desc(e)'
> +  $ hg --config histedit.dropmissing=True histedit -r 0 --commands $PLAN 2>&1 | fixbundle
>    $ hg log --graph
>    @  changeset:   1:e99c679bf03e
>    |  tag:         tip
> diff --git a/tests/test-histedit-edit.t b/tests/test-histedit-edit.t
> --- a/tests/test-histedit-edit.t
> +++ b/tests/test-histedit-edit.t
> @@ -59,20 +59,20 @@
>
>  dirty a file
>    $ echo a > g
> -  $ hg histedit 177f92b77385 --commands - 2>&1 << EOF
> -  > EOF
> +  $ plan
> +  $ hg histedit 'desc(c)' --commands $PLAN 2>&1
>    abort: uncommitted changes
>    [255]
>    $ echo g > g
>
>  edit the history
> -  $ hg histedit 177f92b77385 --commands - 2>&1 << EOF| fixbundle
> -  > pick 177f92b77385 c
> -  > pick 055a42cdd887 d
> -  > edit e860deea161a e
> -  > pick 652413bf663e f
> -  > pick 3c6a8ed2ebe8 g
> -  > EOF
> +  $ plan
> +  $ pick 'desc(c)'
> +  $ pick 'desc(d)'
> +  $ edit 'desc(e)'
> +  $ pick 'desc(f)'
> +  $ pick 'desc(g)'
> +  $ hg histedit 'desc(c)' --commands $PLAN 2>&1 | fixbundle
>    0 files updated, 0 files merged, 3 files removed, 0 files unresolved
>    Editing (e860deea161a), you may commit or record as needed now.
>    (hg histedit --continue to resume)
> @@ -102,11 +102,11 @@
>    strip-backup/177f92b77385-0ebe6a8f-histedit.hg
>
>  edit the plan via --commands
> -  $ hg histedit --edit-plan --commands - 2>&1 << EOF
> -  > edit e860deea161a e
> -  > pick 652413bf663e f
> -  > drop 3c6a8ed2ebe8 g
> -  > EOF
> +  $ plan
> +  $ edit 'desc(e)'
> +  $ pick 'desc(f)'
> +  $ drop 'desc(g)'
> +  $ hg histedit --edit-plan --commands $PLAN 2>&1
>    $ cat .hg/histedit-state
>    v1
>    055a42cdd88768532f9cf79daa407fc8d138de9b
> @@ -192,11 +192,11 @@
>
>  Stripping necessary commits should not break --abort
>
> -  $ hg histedit 1a60820cd1f6 --commands - 2>&1 << EOF| fixbundle
> -  > edit 1a60820cd1f6 wat
> -  > pick a5e1ba2f7afb foobaz
> -  > pick b5f70786f9b0 g
> -  > EOF
> +  $ plan
> +  $ edit 'desc(wat)'
> +  $ pick 'desc(foobaz)'
> +  $ pick 'desc(f)'
> +  $ hg histedit 'desc(wat)' --commands $PLAN 2>&1 | fixbundle
>    0 files updated, 0 files merged, 2 files removed, 0 files unresolved
>    Editing (1a60820cd1f6), you may commit or record as needed now.
>    (hg histedit --continue to resume)
> @@ -236,9 +236,9 @@
>
>
>
> -  $ hg histedit tip --commands - 2>&1 <<EOF| fixbundle
> -  > edit b5f70786f9b0 f
> -  > EOF
> +  $ plan
> +  $ edit tip
> +  $ hg histedit tip --commands $PLAN 2>&1 | fixbundle
>    0 files updated, 0 files merged, 1 files removed, 0 files unresolved
>    Editing (b5f70786f9b0), you may commit or record as needed now.
>    (hg histedit --continue to resume)
> @@ -323,9 +323,9 @@
>  (test that editor is not invoked before transaction starting)
>
>    $ rm -f .hg/last-message.txt
> -  $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit tip --commands - 2>&1 << EOF | fixbundle
> -  > mess 1fd3b2fe7754 f
> -  > EOF
> +  $ plan
> +  $ mess 'desc(f)'
> +  $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit tip --commands $PLAN 2>&1 | fixbundle
>    abort: emulating unexpected abort
>    $ test -f .hg/last-message.txt
>    [1]
> @@ -349,9 +349,9 @@
>    A f
>
>    $ rm -f .hg/last-message.txt
> -  $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit tip --commands - 2>&1 << EOF
> -  > mess 1fd3b2fe7754 f
> -  > EOF
> +  $ plan
> +  $ mess 'desc(f)'
> +  $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit tip --commands $PLAN 2>&1
>    ==== before editing
>    f
>
> @@ -401,9 +401,9 @@
>
>  then, check "modify the message" itself
>
> -  $ hg histedit tip --commands - 2>&1 << EOF | fixbundle
> -  > mess 1fd3b2fe7754 f
> -  > EOF
> +  $ plan
> +  $ mess 'desc(f)'
> +  $ hg histedit tip --commands $PLAN 2>&1 | fixbundle
>    $ hg status
>    $ hg log --limit 1
>    changeset:   6:62feedb1200e
> @@ -422,9 +422,9 @@
>    $ hg clone -qr0 r r0
>    $ cd r0
>    $ hg phase -fdr0
> -  $ hg histedit --commands - 0 2>&1 << EOF
> -  > edit cb9a9f314b8b a > $EDITED
> -  > EOF
> +  $ plan
> +  > edit cb9a9f314b8b a
> +  $ hg histedit --commands $PLAN 0 2>&1
>    0 files updated, 0 files merged, 1 files removed, 0 files unresolved
>    adding a
>    Editing (cb9a9f314b8b), you may commit or record as needed now.
> 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
> @@ -48,12 +48,12 @@
>    o  0:cb9a9f314b8b a
>
>
> -  $ hg histedit 177f92b77385 --commands - 2>&1 <<EOF | fixbundle
> -  > pick e860deea161a e
> -  > pick 652413bf663e f
> -  > fold 177f92b77385 c
> -  > pick 055a42cdd887 d
> -  > EOF
> +  $ plan
> +  $ pick 'desc(e)'
> +  $ pick 'desc(f)'
> +  $ fold 'desc(c)'
> +  $ pick 'desc(d)'
> +  $ hg histedit 'desc(c)' --commands $PLAN 2>&1 | fixbundle
>
>  log after edit
>    $ hg logt --graph
> @@ -102,12 +102,12 @@
>
>    $ OLDHGEDITOR=$HGEDITOR
>    $ HGEDITOR=false
> -  $ hg histedit d2ae7f538514 --commands - 2>&1 <<EOF | fixbundle
> -  > pick d2ae7f538514 b
> -  > roll ee283cb5f2d5 e
> -  > pick 6de59d13424a f
> -  > pick 9c277da72c9b d
> -  > EOF
> +  $ plan
> +  $ pick 'desc(b)'
> +  $ roll 'desc(e)'
> +  $ pick 'desc(f)'
> +  $ pick 'desc(d)'
> +  $ hg histedit 'desc(b)' --commands $PLAN 2>&1 | fixbundle
>
>    $ HGEDITOR=$OLDHGEDITOR
>
> @@ -167,10 +167,10 @@
>    A c
>    A d
>    A f
> -  $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit 8e03a72b6f83 --commands - 2>&1 <<EOF
> -  > pick 8e03a72b6f83 f
> -  > fold c4a9eb7989fc d
> -  > EOF
> +  $ plan
> +  $ pick 'desc(f)'
> +  $ fold 'desc(d)'
> +  $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit 'desc(f)' --commands $PLAN 2>&1
>    allow non-folding commit
>    ==== before editing
>    f
> @@ -225,12 +225,12 @@
>    summary:     f
>
>
> +  $ plan
> +  $ pick 'desc(e)'
> +  $ fold 'desc(f)'
>    $ hg --config progress.debug=1 --debug \
> -  > histedit e860deea161a --commands - 2>&1 <<EOF | \
> +  > histedit 'desc(e)' --commands $PLAN 2>&1 | \
>    > egrep 'editing|unresolved'
> -  > pick e860deea161a e
> -  > fold a00ad806cb55 f
> -  > EOF
>    editing: pick e860deea161a 4 e 1/2 changes (50.00%)
>    editing: fold a00ad806cb55 5 f 2/2 changes (100.00%)
>
> @@ -273,11 +273,11 @@
>    o  0:0189ba417d34 1+2+3
>
>
> -  $ hg histedit 1 --commands - << EOF
> -  > pick 617f94f13c0f 1 +4
> -  > drop 888f9082bf99 2 +5
> -  > fold 251d831eeec5 3 +6
> -  > EOF
> +  $ plan
> +  $ pick 'desc(4)'
> +  $ drop 'desc(5)'
> +  $ fold 'desc(6)'
> +  $ hg histedit 'desc(4)' --commands $PLAN
>    1 files updated, 0 files merged, 0 files removed, 0 files unresolved
>    merging file
>    warning: conflicts while merging file! (edit, then use 'hg resolve --mark')
> @@ -335,11 +335,11 @@
>    |
>    o  0:0189ba417d34 1+2+3
>
> -  $ hg histedit 1 --commands -  << EOF
> -  > pick 617f94f13c0f 1 +4
> -  > drop 888f9082bf99 2 +5
> -  > fold 251d831eeec5 3 +6
> -  > EOF
> +  $ plan
> +  $ pick 'desc(4)'
> +  $ drop 'desc(5)'
> +  $ fold 'desc(6)'
> +  $ hg histedit 'desc(4)' --commands $PLAN
>    1 files updated, 0 files merged, 0 files removed, 0 files unresolved
>    merging file
>    warning: conflicts while merging file! (edit, then use 'hg resolve --mark')
> @@ -425,10 +425,10 @@
>    1:1c4f440a8085 rename
>    0:6c795aa153cb a
>
> -  $ hg histedit 1c4f440a8085 --commands - 2>&1 << EOF | fixbundle
> -  > pick 1c4f440a8085 rename
> -  > fold e0371e0426bc b
> -  > EOF
> +  $ plan
> +  $ pick 'desc(rename)'
> +  $ fold 'desc(b)'
> +  $ hg histedit 'desc(rename)' --commands $PLAN 2>&1 | fixbundle
>
>    $ hg logt --follow b.txt
>    1:cf858d235c76 rename
> @@ -466,11 +466,11 @@
>  #else
>    $ NODE="\$HG_NODE"
>  #endif
> -  $ hg histedit 6c795aa153cb --config hooks.commit="echo commit $NODE" --commands - 2>&1 << EOF | fixbundle
> -  > pick 199b6bb90248 b
> -  > fold a1a953ffb4b0 c
> -  > pick 6c795aa153cb a
> -  > EOF
> +  $ plan
> +  $ pick 'desc(b)'
> +  $ fold 'desc(c)'
> +  $ pick 'desc(a)'
> +  $ hg histedit 'desc(a)' --config hooks.commit="echo commit $NODE" --commands $PLAN 2>&1 | fixbundle
>    commit 9599899f62c05f4377548c32bf1c9f1a39634b0c
>
>    $ hg logt
> @@ -503,12 +503,12 @@
>    > echo END >> "$TESTTMP/editorlog.txt"
>    > echo merged foos > \$1
>    > EOF
> -  $ HGEDITOR="sh \"$TESTTMP/editor.sh\"" hg histedit 1 --commands - 2>&1 <<EOF | fixbundle
> -  > pick 578c7455730c 1 a
> -  > pick 0e01aeef5fa8 2 foo1
> -  > fold b7389cc4d66e 3 foo2
> -  > fold 21679ff7675c 4 foo3
> -  > EOF
> +  $ plan
> +  $ pick 'desc(a)'
> +  $ pick 'desc(foo1)'
> +  $ fold 'desc(foo2)'
> +  $ fold 'desc(foo3)'
> +  $ HGEDITOR="sh \"$TESTTMP/editor.sh\"" hg histedit 'desc(a)' --commands $PLAN 2>&1 | fixbundle
>    $ hg logt
>    2:e8bedbda72c1 merged foos
>    1:578c7455730c a
> diff --git a/tests/test-histedit-non-commute-abort.t b/tests/test-histedit-non-commute-abort.t
> --- a/tests/test-histedit-non-commute-abort.t
> +++ b/tests/test-histedit-non-commute-abort.t
> @@ -62,13 +62,13 @@
>
>
>  edit the history
> -  $ hg histedit 177f92b77385 --commands - 2>&1 <<EOF | fixbundle
> -  > pick 177f92b77385 c
> -  > pick 055a42cdd887 d
> -  > pick bfa474341cc9 does not commute with e
> -  > pick e860deea161a e
> -  > pick 652413bf663e f
> -  > EOF
> +  $ plan
> +  $ pick 'desc(c)-desc(does)'
> +  $ pick 'desc(d)-desc(does)'
> +  $ pick 'desc(does)'
> +  $ pick 'desc(e)-desc(does)'
> +  $ pick 'desc(f)'
> +  $ hg histedit 'desc(c)-desc(does)' --commands $PLAN 2>&1  | fixbundle
>    merging e
>    warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
>    Fix up the change (pick e860deea161a)
> 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
> @@ -29,17 +29,17 @@
>    $ echo a > d
>    $ hg ci -Am c
>    adding d
> -  $ echo "pick `hg log -r 0 -T '{node|short}'`" > plan
> -  $ echo "pick `hg log -r 2 -T '{node|short}'`" >> plan
> -  $ echo "edit `hg log -r 1 -T '{node|short}'`" >> plan
> -  $ hg histedit -r 'all()' --commands plan
> +  $ plan
> +  $ pick 'desc(a)'
> +  $ pick 'desc(c)'
> +  $ edit 'desc(b)'
> +  $ hg histedit -r 'all()' --commands $PLAN
>    Editing (1b2d564fad96), you may commit or record as needed now.
>    (hg histedit --continue to resume)
>    [1]
>    $ hg st
>    A b
>    A c
> -  ? plan
>    $ hg commit --amend b
>    $ hg histedit --continue
>    $ hg log -G
> @@ -102,13 +102,13 @@
>    #  f, fold = use commit, but combine it with the one above
>    #  r, roll = like fold, but discard this commit's description
>    #
> -  $ hg histedit 1 --commands - --verbose <<EOF | grep histedit
> -  > pick 177f92b77385 2 c
> -  > drop d2ae7f538514 1 b
> -  > pick 055a42cdd887 3 d
> -  > fold e860deea161a 4 e
> -  > pick 652413bf663e 5 f
> -  > EOF
> +  $ plan
> +  $ pick 'desc(c)'
> +  $ drop 'desc(b)'
> +  $ pick 'desc(d)'
> +  $ fold 'desc(e)'
> +  $ pick 'desc(f)'
> +  $ hg histedit 'desc(b)' --commands $PLAN --verbose|grep histedit
>    [1]
>    $ hg log --graph --hidden
>    @  10:cacdfd884a93 f
> @@ -148,11 +148,11 @@
>
>  create an hidden revision
>
> -  $ hg histedit 6 --commands - << EOF
> -  > pick b346ab9a313d 6 c
> -  > drop 59d9f330561f 7 d
> -  > pick cacdfd884a93 8 f
> -  > EOF
> +  $ plan
> +  $ pick 'desc(c)'
> +  $ drop 'desc(d)'
> +  $ pick 'desc(f)'
> +  $ hg histedit 'desc(c)' --commands $PLAN
>    $ hg log --graph
>    @  11:c13eb81022ca f
>    |
> @@ -162,10 +162,10 @@
>
>  check hidden revision are ignored (6 have hidden children 7 and 8)
>
> -  $ hg histedit 6 --commands - << EOF
> -  > pick b346ab9a313d 6 c
> -  > pick c13eb81022ca 8 f
> -  > EOF
> +  $ plan
> +  $ pick 'desc(c)'
> +  $ pick 'desc(f)'
> +  $ hg histedit 'desc(c)' --commands $PLAN
>
>
>
> @@ -176,9 +176,9 @@
>    0 files updated, 0 files merged, 1 files removed, 0 files unresolved
>    $ hg log -r 'children(.)'
>    11:c13eb81022ca f (no-eol)
> -  $ hg histedit -r '.' --commands - <<EOF
> -  > edit b346ab9a313d 6 c
> -  > EOF
> +  $ plan
> +  $ edit 'desc(c)'
> +  $ hg histedit -r '.' --commands $PLAN
>    0 files updated, 0 files merged, 1 files removed, 0 files unresolved
>    adding c
>    Editing (b346ab9a313d), you may commit or record as needed now.
> @@ -207,10 +207,10 @@
>    updating to branch default
>    3 files updated, 0 files merged, 0 files removed, 0 files unresolved
>    $ cd droplast
> -  $ hg histedit -r '40db8afa467b' --commands - << EOF
> -  > pick 40db8afa467b 10 c
> -  > drop b449568bf7fc 11 f
> -  > EOF
> +  $ plan
> +  $ pick 'desc(c)'
> +  $ drop 'desc(f)'
> +  $ hg histedit 'desc(c)' --commands $PLAN
>    $ hg log -G
>    @  12:40db8afa467b c
>    |
> @@ -225,11 +225,11 @@
>    $ echo f > f
>    $ hg add f
>    $ hg commit -m h
> -  $ hg histedit -r '40db8afa467b' --commands - << EOF
> -  > pick 47a8561c0449 12 g
> -  > pick 40db8afa467b 10 c
> -  > drop 1b3b05f35ff0 13 h
> -  > EOF
> +  $ plan
> +  $ pick 'desc(g)'
> +  $ pick 'desc(c)'
> +  $ drop 'desc(h)'
> +  $ hg histedit -r 'desc(c)' --commands $PLAN
>    $ hg log -G
>    @  17:ee6544123ab8 c
>    |
> @@ -305,14 +305,14 @@
>
>    $ cp -r base simple-draft
>    $ cd simple-draft
> -  $ hg histedit -r 'b449568bf7fc' --commands - << EOF
> -  > edit b449568bf7fc 11 f
> -  > pick 6b70183d2492 12 g
> -  > pick 7395e1ff83bd 13 h
> -  > pick b605fb7503f2 14 i
> -  > pick 3a6c53ee7f3d 15 j
> -  > pick ee118ab9fa44 16 k
> -  > EOF
> +  $ plan
> +  $ edit 'desc(f)'
> +  $ pick 'desc(g)'
> +  $ pick 'desc(h)'
> +  $ pick 'desc(i)'
> +  $ pick 'desc(j)'
> +  $ pick 'desc(k)'
> +  $ hg histedit -r 'desc(f)' --commands $PLAN
>    0 files updated, 0 files merged, 6 files removed, 0 files unresolved
>    adding f
>    Editing (b449568bf7fc), you may commit or record as needed now.
> @@ -348,14 +348,14 @@
>    > [phases]
>    > new-commit=secret
>    > EOF
> -  $ hg histedit -r 'b449568bf7fc' --commands - << EOF
> -  > edit b449568bf7fc 11 f
> -  > pick 6b70183d2492 12 g
> -  > pick 7395e1ff83bd 13 h
> -  > pick b605fb7503f2 14 i
> -  > pick 3a6c53ee7f3d 15 j
> -  > pick ee118ab9fa44 16 k
> -  > EOF
> +  $ plan
> +  $ edit 'desc(f)'
> +  $ pick 'desc(g)'
> +  $ pick 'desc(h)'
> +  $ pick 'desc(i)'
> +  $ pick 'desc(j)'
> +  $ pick 'desc(k)'
> +  $ hg histedit -r 'desc(f)' --commands $PLAN
>    0 files updated, 0 files merged, 6 files removed, 0 files unresolved
>    adding f
>    Editing (b449568bf7fc), you may commit or record as needed now.
> @@ -391,14 +391,14 @@
>
>    $ cp -r base reorder
>    $ cd reorder
> -  $ hg histedit -r 'b449568bf7fc' --commands - << EOF
> -  > pick b449568bf7fc 11 f
> -  > pick 3a6c53ee7f3d 15 j
> -  > pick 6b70183d2492 12 g
> -  > pick b605fb7503f2 14 i
> -  > pick 7395e1ff83bd 13 h
> -  > pick ee118ab9fa44 16 k
> -  > EOF
> +  $ plan
> +  $ pick 'desc(f)'
> +  $ pick 'desc(j)'
> +  $ pick 'desc(g)'
> +  $ pick 'desc(i)'
> +  $ pick 'desc(h)'
> +  $ pick 'desc(k)'
> +  $ hg histedit -r 'desc(f)' --commands $PLAN
>    $ hg log -G
>    @  23:558246857888 (secret) k
>    |
> @@ -432,14 +432,14 @@
>    > [phases]
>    > new-commit=secret
>    > EOF
> -  $ hg histedit -r 'b449568bf7fc' --commands - << EOF
> -  > pick 7395e1ff83bd 13 h
> -  > fold b449568bf7fc 11 f
> -  > pick 6b70183d2492 12 g
> -  > fold 3a6c53ee7f3d 15 j
> -  > pick b605fb7503f2 14 i
> -  > fold ee118ab9fa44 16 k
> -  > EOF
> +  $ plan
> +  $ pick 'desc(h)'
> +  $ fold 'desc(f)'
> +  $ pick 'desc(g)'
> +  $ fold 'desc(j)'
> +  $ pick 'desc(i)'
> +  $ fold 'desc(k)'
> +  $ hg histedit -r 'desc(f)' --commands $PLAN
>    $ hg log -G
>    @  27:f9daec13fb98 (secret) i
>    |
> @@ -451,19 +451,19 @@
>    |
>    o  0:cb9a9f314b8b (public) a
>
> -  $ hg co 49807617f46a
> +  $ hg co 'desc(g)'
>    0 files updated, 0 files merged, 2 files removed, 0 files unresolved
>    $ echo wat >> wat
>    $ hg add wat
>    $ hg ci -m 'add wat'
>    created new head
> -  $ hg merge f9daec13fb98
> +  $ hg merge 'desc(i)'
>    2 files updated, 0 files merged, 0 files removed, 0 files unresolved
>    (branch merge, don't forget to commit)
>    $ hg ci -m 'merge'
>    $ echo not wat > wat
>    $ hg ci -m 'modify wat'
> -  $ hg histedit 050280826e04
> +  $ hg histedit 'desc(h)'
>    abort: cannot edit history that contains merges
>    [255]
>    $ cd ..
> diff --git a/tests/test-keyword.t b/tests/test-keyword.t
> --- a/tests/test-keyword.t
> +++ b/tests/test-keyword.t
> @@ -1,3 +1,5 @@
> +  $ . "$TESTDIR/histedit-helpers.sh"
> +
>    $ cat <<EOF >> $HGRCPATH
>    > [extensions]
>    > keyword =
> @@ -1307,10 +1309,10 @@
>    > EOF
>
>    $ hg commit -m 'backout #11'
> -  $ hg histedit -q --command - 13 <<EOF
> -  > pick 49f5f2d940c3 14 backout #11
> -  > pick 01a68de1003a 13 9foobranch
> -  > EOF
> +  $ plan
> +  $ pick 'desc(backout)'
> +  $ pick 'desc(backout)^'
> +  $ hg histedit -q --command $PLAN 'desc(backout)^'
>
>  Test restricted mode with fetch (with merge)
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list