tests/test-histedit-edit
changeset 17090 e64d416b6b94
parent 17076 75f4180509a4
parent 17089 0c1d10351869
child 17091 f7a2849ef8cd
equal deleted inserted replaced
17076:75f4180509a4 17090:e64d416b6b94
     1 #!/bin/sh
       
     2 
       
     3 . "$TESTDIR/histedit-helpers.sh"
       
     4 
       
     5 cat >> $HGRCPATH <<EOF
       
     6 [extensions]
       
     7 graphlog=
       
     8 histedit=
       
     9 EOF
       
    10 
       
    11 EDITED=`pwd`/editedhistory
       
    12 cat > $EDITED <<EOF
       
    13 pick 177f92b77385 c
       
    14 pick 055a42cdd887 d
       
    15 edit e860deea161a e
       
    16 pick 652413bf663e f
       
    17 EOF
       
    18 initrepo ()
       
    19 {
       
    20     hg init r
       
    21     cd r
       
    22     for x in a b c d e f ; do
       
    23         echo $x > $x
       
    24         hg add $x
       
    25         hg ci -m $x
       
    26     done
       
    27 }
       
    28 
       
    29 initrepo
       
    30 
       
    31 echo % log before edit
       
    32 hg log --graph
       
    33 
       
    34 echo % edit the history
       
    35 HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
       
    36 
       
    37 echo % commit, then edit the revision
       
    38 hg ci -m 'wat'
       
    39 echo a > e
       
    40 HGEDITOR='echo "foobaz" > ' hg histedit --continue 2>&1 | fixbundle
       
    41 
       
    42 hg log --graph
       
    43 
       
    44 echo '% contents of e:'
       
    45 hg cat e
       
    46 
       
    47 cat > $EDITED <<EOF
       
    48 edit bf757c081cd0 f
       
    49 EOF
       
    50 HGEDITOR="cat $EDITED > " hg histedit tip 2>&1 | fixbundle
       
    51 hg status
       
    52 HGEDITOR='true' hg histedit --continue
       
    53 hg status
       
    54 
       
    55 echo % log after edit
       
    56 hg log --limit 1
       
    57 
       
    58 echo "% say we'll change the message, but don't."
       
    59 cat > ../edit.sh <<EOF
       
    60 #!/bin/sh
       
    61 cat \$1 | sed s/pick/mess/ > tmp
       
    62 mv tmp \$1
       
    63 EOF
       
    64 chmod +x ../edit.sh
       
    65 HGEDITOR="../edit.sh" hg histedit tip 2>&1 | fixbundle
       
    66 hg status
       
    67 hg log --limit 1
       
    68 
       
    69 echo % modify the message
       
    70 cat > $EDITED <<EOF
       
    71 mess bf757c081cd0 f
       
    72 EOF
       
    73 HGEDITOR="cat $EDITED > " hg histedit tip 2>&1 | fixbundle
       
    74 hg status
       
    75 hg log --limit 1
       
    76 
       
    77 echo % rollback should not work after a histedit
       
    78 hg rollback
       
    79 
       
    80 echo % EOF