Mercurial > hg
annotate tests/test-rebase-conflicts @ 11988:8380ed691df8
util: add an interpolate() function to for replacing multiple values
util.interpolate can be used to replace multiple items in a string all at once
(and optionally apply a function to the replacement), without worrying about
recursing:
>>> import util
>>> s = '$foo, $spam'
>>> util.interpolate(r'\$', { 'foo': 'bar', 'spam': 'eggs' }, s)
'bar, eggs'
>>> util.interpolate(r'\$', { 'foo': 'spam', 'spam': 'foo' }, s)
'spam, foo'
>>> util.interpolate(r'\$', { 'foo': 'spam', 'spam': 'foo' }, s, lambda s: s.upper())
'SPAM, FOO'
The patch also changes filemerge.py to use this new function.
author | Steve Losh <steve@stevelosh.com> |
---|---|
date | Wed, 18 Aug 2010 18:18:26 -0400 |
parents | 2313dc4d9817 |
children |
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 |
11208
2313dc4d9817
tests: fix bashism to load helpers.sh
Yuya Nishihara <yuya@tcha.org>
parents:
11198
diff
changeset
|
3 . $TESTDIR/helpers.sh |
11198
b345b1cc124f
rebase: use helpers.sh in tests
Matt Mackall <mpm@selenic.com>
parents:
8168
diff
changeset
|
4 |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
5 echo "[extensions]" >> $HGRCPATH |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
6 echo "graphlog=" >> $HGRCPATH |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
7 echo "rebase=" >> $HGRCPATH |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
8 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
9 hg init a |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
10 cd a |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
11 echo 'c1' >common |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
12 hg add common |
8168
8766fee6f225
tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents:
7278
diff
changeset
|
13 hg commit -d '0 0' -m "C1" |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
14 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
15 echo 'c2' >>common |
8168
8766fee6f225
tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents:
7278
diff
changeset
|
16 hg commit -d '1 0' -m "C2" |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
17 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
18 echo 'c3' >>common |
8168
8766fee6f225
tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents:
7278
diff
changeset
|
19 hg commit -d '2 0' -m "C3" |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
20 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
21 hg update -C 1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
22 echo 'l1' >>extra |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
23 hg add extra |
8168
8766fee6f225
tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents:
7278
diff
changeset
|
24 hg commit -d '3 0' -m "L1" |
6906
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 sed -e 's/c2/l2/' common > common.new |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
27 mv common.new common |
8168
8766fee6f225
tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents:
7278
diff
changeset
|
28 hg commit -d '4 0' -m "L2" |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
29 |
7278
45495d784ad6
rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
30 echo 'l3' >> extra2 |
45495d784ad6
rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
31 hg add extra2 |
8168
8766fee6f225
tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents:
7278
diff
changeset
|
32 hg commit -d '5 0' -m "L3" |
7278
45495d784ad6
rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
33 |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
34 hg glog --template '{rev}: {desc}\n' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
35 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
36 echo |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
37 echo '% Try to call --continue' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
38 hg rebase --continue |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
39 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
40 echo |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
41 echo '% Conflicting rebase' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
42 hg rebase -s 3 -d 2 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
43 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
44 echo |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
45 echo '% Try to continue without solving the conflict' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
46 hg rebase --continue |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
47 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
48 echo |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
49 echo '% Conclude rebase' |
7278
45495d784ad6
rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
50 echo 'resolved merge' >common |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
51 hg resolve -m common |
11198
b345b1cc124f
rebase: use helpers.sh in tests
Matt Mackall <mpm@selenic.com>
parents:
8168
diff
changeset
|
52 hg rebase --continue | cleanrebase |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
53 |
7278
45495d784ad6
rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
54 hg glog --template '{rev}: {desc}\n' |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
55 |
7278
45495d784ad6
rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
56 echo |
45495d784ad6
rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
57 echo '% Check correctness' |
45495d784ad6
rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
58 echo ' - Rev. 0' |
45495d784ad6
rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
59 hg cat -r 0 common |
45495d784ad6
rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
60 |
45495d784ad6
rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
61 echo ' - Rev. 1' |
45495d784ad6
rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
62 hg cat -r 1 common |
45495d784ad6
rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
63 |
45495d784ad6
rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
64 echo ' - Rev. 2' |
45495d784ad6
rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
65 hg cat -r 2 common |
45495d784ad6
rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
66 |
45495d784ad6
rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
67 echo ' - Rev. 3' |
45495d784ad6
rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
68 hg cat -r 3 common |
45495d784ad6
rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
69 |
45495d784ad6
rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
70 echo ' - Rev. 4' |
45495d784ad6
rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
71 hg cat -r 4 common |
45495d784ad6
rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
72 |
45495d784ad6
rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
73 echo ' - Rev. 5' |
45495d784ad6
rebase: avoid redundant merges (issue1301)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
74 hg cat -r 5 common |