tests/test-histedit-commute
author Mads Kiilerich <mads@kiilerich.com>
Sat, 30 Jun 2012 03:34:41 +0200
changeset 17084 69dae7982c85
parent 17064 168cc52ad7c2
permissions -rwxr-xr-x
histedit: use stable iteration order for processing bookmarks Random dict iteration order caused test failure in test-histedit-bookmark-motion.t.

#!/bin/sh

. "$TESTDIR/histedit-helpers.sh"

cat >> $HGRCPATH <<EOF
[extensions]
graphlog=
histedit=
EOF

EDITED=`pwd`/editedhistory
cat > $EDITED <<EOF
pick 177f92b77385 c
pick e860deea161a e
pick 652413bf663e f
pick 055a42cdd887 d
EOF
initrepo ()
{
    hg init r
    cd r
    for x in a b c d e f ; do
        echo $x > $x
        hg add $x
        hg ci -m $x
    done
}

initrepo

echo % log before edit
hg log --graph

echo % show the edit commands offered
HGEDITOR=cat hg histedit 177f92b77385

echo % edit the history
HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle

echo % rules should end up in .hg/histedit-last-edit.txt:
cat .hg/histedit-last-edit.txt
echo '**** end of rules file ****'

echo % log after edit
hg log --graph

echo % put things back

cat > $EDITED <<EOF
pick 177f92b77385 c
pick 853c68da763f d
pick b069cc29fb22 e
pick 26f6a030ae82 f
EOF
HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle

hg log --graph


echo % slightly different this time

cat > $EDITED <<EOF
pick 055a42cdd887 d
pick 652413bf663e f
pick e860deea161a e
pick 177f92b77385 c
EOF
HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
hg log --graph


echo % keep prevents stripping dead revs
cat > $EDITED <<EOF
pick bfe4a5a76b37 d
pick c4f52e213402 f
pick 99a62755c625 c
pick 7c6fdd608667 e
EOF
HGEDITOR="cat $EDITED > " hg histedit bfe4a5a76b37 --keep 2>&1 | fixbundle
hg log --graph

echo '% try with --rev'
cat > $EDITED <<EOF
pick 7c6fdd608667 e
pick 99a62755c625 c
EOF
hg histedit --commands "$EDITED" --rev -2 2>&1 | fixbundle
hg log --graph

echo % should also work if a commit message is missing
BUNDLE="$TESTDIR/missing-comment.hg"
hg init missing
cd missing
hg unbundle $BUNDLE
hg co tip
hg log --graph
hg histedit 0