tests/test-rebase-mq
author Brodie Rao <me+hg@dackz.net>
Sun, 14 Feb 2010 01:52:31 -0500
branchstable
changeset 10463 5ddde896a19d
parent 10397 8cb81d75730c
child 10672 c2e1e637d4da
permissions -rwxr-xr-x
remove unused imports
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6906
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     2
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     3
echo "[extensions]" >> $HGRCPATH
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     4
echo "graphlog=" >> $HGRCPATH
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     5
echo "rebase=" >> $HGRCPATH
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     6
echo "mq=" >> $HGRCPATH
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     7
10397
8cb81d75730c mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents: 8168
diff changeset
     8
echo "[mq]" >> $HGRCPATH
8cb81d75730c mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents: 8168
diff changeset
     9
echo "plain=true" >> $HGRCPATH
8cb81d75730c mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents: 8168
diff changeset
    10
6931
02f4a0bcfdce test-rebase-mq: '|' is a GNU sed extension, unfold it
Patrick Mezard <pmezard@gmail.com>
parents: 6906
diff changeset
    11
filterpatch()
02f4a0bcfdce test-rebase-mq: '|' is a GNU sed extension, unfold it
Patrick Mezard <pmezard@gmail.com>
parents: 6906
diff changeset
    12
{
02f4a0bcfdce test-rebase-mq: '|' is a GNU sed extension, unfold it
Patrick Mezard <pmezard@gmail.com>
parents: 6906
diff changeset
    13
    sed -e "s/^\(# Date\).*/\1/" \
02f4a0bcfdce test-rebase-mq: '|' is a GNU sed extension, unfold it
Patrick Mezard <pmezard@gmail.com>
parents: 6906
diff changeset
    14
        -e "s/^\(# Node ID\).*/\1/" \
02f4a0bcfdce test-rebase-mq: '|' is a GNU sed extension, unfold it
Patrick Mezard <pmezard@gmail.com>
parents: 6906
diff changeset
    15
        -e "s/^\(# Parent\).*/\1/" \
02f4a0bcfdce test-rebase-mq: '|' is a GNU sed extension, unfold it
Patrick Mezard <pmezard@gmail.com>
parents: 6906
diff changeset
    16
        -e "s/^\(diff -r \)\([a-f0-9]* \)\(-r \)\([a-f0-9]* \)/\1x \3y /" \
7955
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
    17
        -e "s/^\(diff -r \)\([a-f0-9]* \)/\1x /" \
6931
02f4a0bcfdce test-rebase-mq: '|' is a GNU sed extension, unfold it
Patrick Mezard <pmezard@gmail.com>
parents: 6906
diff changeset
    18
        -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" \
02f4a0bcfdce test-rebase-mq: '|' is a GNU sed extension, unfold it
Patrick Mezard <pmezard@gmail.com>
parents: 6906
diff changeset
    19
        -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/"
02f4a0bcfdce test-rebase-mq: '|' is a GNU sed extension, unfold it
Patrick Mezard <pmezard@gmail.com>
parents: 6906
diff changeset
    20
}
02f4a0bcfdce test-rebase-mq: '|' is a GNU sed extension, unfold it
Patrick Mezard <pmezard@gmail.com>
parents: 6906
diff changeset
    21
6906
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    22
hg init a
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    23
cd a
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    24
hg qinit -c # This must work even with a managed mq queue
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    25
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    26
echo 'c1' > f
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    27
hg add f
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7955
diff changeset
    28
hg commit -d '0 0' -m "C1"
6906
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    29
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    30
echo 'r1' > f
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7955
diff changeset
    31
hg commit -d '2 0' -m "R1"
6906
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    32
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    33
hg up 0
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    34
hg qnew f.patch
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    35
echo 'mq1' > f
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    36
hg qref -m 'P0'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    37
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    38
hg qnew f2.patch
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    39
echo 'mq2' > f
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    40
hg qref -m 'P1'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    41
hg glog  --template '{rev} {desc} tags: {tags}\n'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    42
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    43
echo
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    44
echo '% Rebase - try to rebase on an applied mq patch'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    45
hg rebase -s 1 -d 3
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    46
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    47
echo
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    48
echo '% Rebase - generate a conflict'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    49
hg rebase -s 2 -d 1
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    50
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    51
echo
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    52
echo '% Fix the 1st conflict'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    53
echo 'mq1r1' > f
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    54
hg resolve -m f
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    55
hg rebase -c 2>&1 | sed -e 's/\(saving bundle to \).*/\1/'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    56
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    57
echo
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    58
echo '% Fix the 2nd conflict'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    59
echo 'mq1r1mq2' > f
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    60
hg resolve -m f
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    61
hg rebase -c 2>&1 | sed -e 's/\(saving bundle to \).*/\1/'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    62
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    63
hg glog  --template '{rev} {desc} tags: {tags}\n'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    64
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    65
echo
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    66
echo '% Update to qbase'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    67
hg up qbase
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    68
echo '% f correctly reflects the merge result'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    69
cat f
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    70
echo '% And the patch is correct'
6931
02f4a0bcfdce test-rebase-mq: '|' is a GNU sed extension, unfold it
Patrick Mezard <pmezard@gmail.com>
parents: 6906
diff changeset
    71
cat .hg/patches/f.patch | filterpatch
6906
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    72
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    73
echo
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    74
echo '% Update to qtip'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    75
hg up qtip
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    76
echo '% f correctly reflects the merge result'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    77
cat f
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    78
echo '% And the patch is correct'
6931
02f4a0bcfdce test-rebase-mq: '|' is a GNU sed extension, unfold it
Patrick Mezard <pmezard@gmail.com>
parents: 6906
diff changeset
    79
cat .hg/patches/f2.patch | filterpatch
02f4a0bcfdce test-rebase-mq: '|' is a GNU sed extension, unfold it
Patrick Mezard <pmezard@gmail.com>
parents: 6906
diff changeset
    80
7955
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
    81
echo
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
    82
echo '% Adding one git-style patch and one normal'
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
    83
hg qpop -a
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
    84
rm -fr .hg/patches
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
    85
hg qinit -c
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
    86
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
    87
hg up 0
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
    88
hg qnew --git f_git.patch
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
    89
echo 'mq1' > p
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
    90
hg add p
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
    91
hg qref --git -m 'P0 (git)'
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
    92
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
    93
hg qnew f.patch
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
    94
echo 'mq2' > p
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
    95
hg qref -m 'P1'
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
    96
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
    97
echo '% Git patch'
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
    98
cat .hg/patches/f_git.patch  | filterpatch
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
    99
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
   100
echo
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
   101
echo '% Normal patch'
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
   102
cat .hg/patches/f.patch | filterpatch
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
   103
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
   104
echo
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
   105
echo '% Rebase the applied mq patches'
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
   106
hg rebase -s 2 -d 1 --quiet 2>&1 | sed -e 's/\(saving bundle to \).*/\1/'
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
   107
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
   108
echo '% And the patches are correct'
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
   109
echo '% Git patch'
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
   110
cat .hg/patches/f_git.patch  | filterpatch
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
   111
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
   112
echo
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
   113
echo '% Normal patch'
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
   114
cat .hg/patches/f.patch | filterpatch
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
   115