tests/test-mq-qfold
author Patrick Mezard <pmezard@gmail.com>
Tue, 09 Mar 2010 22:18:37 +0100
changeset 10619 bcdf37680569
parent 10397 8cb81d75730c
permissions -rwxr-xr-x
Merge with crew-stable
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8426
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     2
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     3
echo "[extensions]" >> $HGRCPATH
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     4
echo "mq=" >> $HGRCPATH
10190
9c2c94934f0d mq: upgrade to git patch when necessary (issue767)
Patrick Mezard <pmezard@gmail.com>
parents: 10186
diff changeset
     5
echo "[mq]" >> $HGRCPATH
9c2c94934f0d mq: upgrade to git patch when necessary (issue767)
Patrick Mezard <pmezard@gmail.com>
parents: 10186
diff changeset
     6
echo "git=keep" >> $HGRCPATH
8426
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     7
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     8
filterdiff()
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     9
{
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    10
    grep -v diff | \
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    11
	sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    12
	-e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    13
}
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    14
10397
8cb81d75730c mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents: 10190
diff changeset
    15
filterpatch()
8cb81d75730c mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents: 10190
diff changeset
    16
{
8cb81d75730c mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents: 10190
diff changeset
    17
    sed -e "s/\(# Parent \).*/\1/"
8cb81d75730c mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents: 10190
diff changeset
    18
}
8cb81d75730c mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents: 10190
diff changeset
    19
8426
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    20
echo '% init'
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    21
hg init repo
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    22
cd repo
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    23
echo a > a
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    24
hg ci -Am adda
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    25
echo a >> a
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    26
hg qnew -f p1
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    27
echo b >> a
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    28
hg qnew -f p2
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    29
echo c >> a
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    30
hg qnew -f p3
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    31
echo '% fold in the middle of the queue'
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    32
hg qpop p1
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    33
hg qdiff | filterdiff
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    34
hg qfold p2
10186
296a0b14a686 mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents: 8426
diff changeset
    35
grep git .hg/patches/p1 && echo 'git patch found!'
8426
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    36
hg qser
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    37
hg qdiff | filterdiff
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    38
echo '% fold with local changes'
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    39
echo d >> a
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    40
hg qfold p3
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    41
hg diff -c . | filterdiff
10186
296a0b14a686 mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents: 8426
diff changeset
    42
hg revert -a --no-backup
296a0b14a686 mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents: 8426
diff changeset
    43
296a0b14a686 mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents: 8426
diff changeset
    44
echo '% fold git patch into a regular patch, expect git patch'
296a0b14a686 mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents: 8426
diff changeset
    45
echo a >> a
296a0b14a686 mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents: 8426
diff changeset
    46
hg qnew -f regular
296a0b14a686 mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents: 8426
diff changeset
    47
hg cp a aa
296a0b14a686 mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents: 8426
diff changeset
    48
hg qnew --git -f git
296a0b14a686 mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents: 8426
diff changeset
    49
hg qpop
296a0b14a686 mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents: 8426
diff changeset
    50
hg qfold git
10397
8cb81d75730c mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents: 10190
diff changeset
    51
cat .hg/patches/regular | filterpatch
10186
296a0b14a686 mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents: 8426
diff changeset
    52
hg qpop
296a0b14a686 mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents: 8426
diff changeset
    53
hg qdel regular
296a0b14a686 mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents: 8426
diff changeset
    54
296a0b14a686 mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents: 8426
diff changeset
    55
echo '% fold regular patch into a git patch, expect git patch'
296a0b14a686 mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents: 8426
diff changeset
    56
hg cp a aa
296a0b14a686 mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents: 8426
diff changeset
    57
hg qnew --git -f git
296a0b14a686 mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents: 8426
diff changeset
    58
echo b >> aa
296a0b14a686 mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents: 8426
diff changeset
    59
hg qnew -f regular
296a0b14a686 mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents: 8426
diff changeset
    60
hg qpop
296a0b14a686 mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents: 8426
diff changeset
    61
hg qfold regular
10397
8cb81d75730c mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents: 10190
diff changeset
    62
cat .hg/patches/git | filterpatch
10186
296a0b14a686 mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents: 8426
diff changeset
    63
8426
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    64
cd ..
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    65
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    66