test-mq-qfold
66 lines
| 1.1 KiB
| text/plain
|
TextLexer
/ tests / test-mq-qfold
Patrick Mezard
|
r8426 | #!/bin/sh | ||
echo "[extensions]" >> $HGRCPATH | ||||
echo "mq=" >> $HGRCPATH | ||||
Patrick Mezard
|
r10190 | echo "[mq]" >> $HGRCPATH | ||
echo "git=keep" >> $HGRCPATH | ||||
Patrick Mezard
|
r8426 | |||
filterdiff() | ||||
{ | ||||
grep -v diff | \ | ||||
sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ | ||||
-e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" | ||||
} | ||||
Steve Losh
|
r10397 | filterpatch() | ||
{ | ||||
sed -e "s/\(# Parent \).*/\1/" | ||||
} | ||||
Patrick Mezard
|
r8426 | echo '% init' | ||
hg init repo | ||||
cd repo | ||||
echo a > a | ||||
hg ci -Am adda | ||||
echo a >> a | ||||
hg qnew -f p1 | ||||
echo b >> a | ||||
hg qnew -f p2 | ||||
echo c >> a | ||||
hg qnew -f p3 | ||||
echo '% fold in the middle of the queue' | ||||
hg qpop p1 | ||||
hg qdiff | filterdiff | ||||
hg qfold p2 | ||||
Patrick Mezard
|
r10186 | grep git .hg/patches/p1 && echo 'git patch found!' | ||
Patrick Mezard
|
r8426 | hg qser | ||
hg qdiff | filterdiff | ||||
echo '% fold with local changes' | ||||
echo d >> a | ||||
hg qfold p3 | ||||
hg diff -c . | filterdiff | ||||
Patrick Mezard
|
r10186 | hg revert -a --no-backup | ||
echo '% fold git patch into a regular patch, expect git patch' | ||||
echo a >> a | ||||
hg qnew -f regular | ||||
hg cp a aa | ||||
hg qnew --git -f git | ||||
hg qpop | ||||
hg qfold git | ||||
Steve Losh
|
r10397 | cat .hg/patches/regular | filterpatch | ||
Patrick Mezard
|
r10186 | hg qpop | ||
hg qdel regular | ||||
echo '% fold regular patch into a git patch, expect git patch' | ||||
hg cp a aa | ||||
hg qnew --git -f git | ||||
echo b >> aa | ||||
hg qnew -f regular | ||||
hg qpop | ||||
hg qfold regular | ||||
Steve Losh
|
r10397 | cat .hg/patches/git | filterpatch | ||
Patrick Mezard
|
r10186 | |||
Patrick Mezard
|
r8426 | cd .. | ||