view tests/test-histedit-commute @ 17070:ad0d6c2b3279

obsolete: introduction of obsolete markers Markers are stored as binary records in a log structured file in .hg/store/obsstore.
author Pierre-Yves.David@ens-lyon.org
date Thu, 07 Jun 2012 19:07:39 +0200
parents 168cc52ad7c2
children
line wrap: on
line source

#!/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