Mercurial > hg
view tests/test-histedit-commute @ 17064:168cc52ad7c2
histedit: new extension for interactive history editing
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Wed, 27 Jun 2012 17:52:54 -0500 |
parents | |
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