annotate tests/test-rebase-mq @ 10843:b91c1804008e

templater: directly parse templates, no regexes
author Matt Mackall <mpm@selenic.com>
date Mon, 05 Apr 2010 14:33:41 -0500
parents c2e1e637d4da
children b345b1cc124f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
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
10672
c2e1e637d4da rebase: always check if rebasing onto an applied mq patch.
Greg Ward <greg-hg@gerg.ca>
parents: 10397
diff changeset
48 echo '% Rebase - same thing, but mq patch is default dest'
c2e1e637d4da rebase: always check if rebasing onto an applied mq patch.
Greg Ward <greg-hg@gerg.ca>
parents: 10397
diff changeset
49 hg update -q 1
c2e1e637d4da rebase: always check if rebasing onto an applied mq patch.
Greg Ward <greg-hg@gerg.ca>
parents: 10397
diff changeset
50 hg rebase
c2e1e637d4da rebase: always check if rebasing onto an applied mq patch.
Greg Ward <greg-hg@gerg.ca>
parents: 10397
diff changeset
51 hg update -q qtip
c2e1e637d4da rebase: always check if rebasing onto an applied mq patch.
Greg Ward <greg-hg@gerg.ca>
parents: 10397
diff changeset
52
c2e1e637d4da rebase: always check if rebasing onto an applied mq patch.
Greg Ward <greg-hg@gerg.ca>
parents: 10397
diff changeset
53 echo
6906
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
54 echo '% Rebase - generate a conflict'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
55 hg rebase -s 2 -d 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 1st conflict'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
59 echo 'mq1r1' > 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 echo
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
64 echo '% Fix the 2nd conflict'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
65 echo 'mq1r1mq2' > f
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
66 hg resolve -m f
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
67 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
68
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
69 hg glog --template '{rev} {desc} tags: {tags}\n'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
70
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
71 echo
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
72 echo '% Update to qbase'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
73 hg up qbase
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
74 echo '% f correctly reflects the merge result'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
75 cat f
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
76 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
77 cat .hg/patches/f.patch | filterpatch
6906
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
78
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
79 echo
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
80 echo '% Update to qtip'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
81 hg up qtip
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
82 echo '% f correctly reflects the merge result'
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
83 cat f
808f03f61ebe Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
84 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
85 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
86
7955
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
87 echo
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
88 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
89 hg qpop -a
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
90 rm -fr .hg/patches
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
91 hg qinit -c
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 up 0
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
94 hg qnew --git f_git.patch
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
95 echo 'mq1' > p
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
96 hg add p
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
97 hg qref --git -m 'P0 (git)'
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
98
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
99 hg qnew f.patch
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
100 echo 'mq2' > p
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
101 hg qref -m 'P1'
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
102
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
103 echo '% Git patch'
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
104 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
105
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
106 echo
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
107 echo '% Normal patch'
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
108 cat .hg/patches/f.patch | filterpatch
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
109
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
110 echo
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
111 echo '% Rebase the applied mq patches'
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
112 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
113
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
114 echo '% And the patches are correct'
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
115 echo '% Git patch'
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
116 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
117
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
118 echo
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
119 echo '% Normal patch'
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
120 cat .hg/patches/f.patch | filterpatch
c3d4ff03ec72 rebase: keep original mq patch format (Issue1574)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6931
diff changeset
121