tests/test-rebase-mq
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
Sun, 19 Oct 2008 01:26:46 +0200
changeset 7154 7fdf7a0a41b7
parent 6931 02f4a0bcfdce
child 7955 c3d4ff03ec72
permissions -rwxr-xr-x
index parser: fix refcounting in case of errors, refactor due to incorrect refcounting, on a bad revlog it was failing with: *** glibc detected *** /usr/bin/python: corrupted double-linked list: 0x0816d318 *** and a backtrace.
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
6931
02f4a0bcfdce test-rebase-mq: '|' is a GNU sed extension, unfold it
Patrick Mezard <pmezard@gmail.com>
parents: 6906
diff changeset
     8
filterpatch()
02f4a0bcfdce test-rebase-mq: '|' is a GNU sed extension, unfold it
Patrick Mezard <pmezard@gmail.com>
parents: 6906
diff changeset
     9
{
02f4a0bcfdce test-rebase-mq: '|' is a GNU sed extension, unfold it
Patrick Mezard <pmezard@gmail.com>
parents: 6906
diff changeset
    10
    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
    11
        -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
    12
        -e "s/^\(# Parent\).*/\1/" \
02f4a0bcfdce test-rebase-mq: '|' is a GNU sed extension, unfold it
Patrick Mezard <pmezard@gmail.com>
parents: 6906
diff changeset
    13
        -e "s/^\(diff -r \)\([a-f0-9]* \)\(-r \)\([a-f0-9]* \)/\1x \3y /" \
02f4a0bcfdce test-rebase-mq: '|' is a GNU sed extension, unfold it
Patrick Mezard <pmezard@gmail.com>
parents: 6906
diff changeset
    14
        -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
    15
        -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
    16
}
02f4a0bcfdce test-rebase-mq: '|' is a GNU sed extension, unfold it
Patrick Mezard <pmezard@gmail.com>
parents: 6906
diff changeset
    17
6906
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    18
hg init a
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    19
cd a
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    20
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
    21
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    22
echo 'c1' > f
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    23
hg add f
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    24
hg commit -d '0 0' -u test -m "C1"
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 'r1' > f
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    27
hg commit -d '2 0' -u test -m "R1"
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    28
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    29
hg up 0
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    30
hg qnew f.patch
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    31
echo 'mq1' > f
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    32
hg qref -m 'P0'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    33
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    34
hg qnew f2.patch
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    35
echo 'mq2' > f
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    36
hg qref -m 'P1'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    37
hg glog  --template '{rev} {desc} tags: {tags}\n'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    38
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    39
echo
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    40
echo '% Rebase - try to rebase on an applied mq patch'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    41
hg rebase -s 1 -d 3
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 - generate a conflict'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    45
hg rebase -s 2 -d 1
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 '% Fix the 1st conflict'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    49
echo 'mq1r1' > f
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    50
hg resolve -m f
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    51
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
    52
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    53
echo
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    54
echo '% Fix the 2nd conflict'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    55
echo 'mq1r1mq2' > f
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    56
hg resolve -m f
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    57
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
    58
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    59
hg glog  --template '{rev} {desc} tags: {tags}\n'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    60
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    61
echo
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    62
echo '% Update to qbase'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    63
hg up qbase
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    64
echo '% f correctly reflects the merge result'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    65
cat f
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    66
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
    67
cat .hg/patches/f.patch | filterpatch
6906
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    68
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    69
echo
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    70
echo '% Update to qtip'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    71
hg up qtip
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    72
echo '% f correctly reflects the merge result'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    73
cat f
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    74
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
    75
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
    76