Mercurial > hg
annotate tests/test-rebase-pull @ 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:
10775
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 |
6910 | 9 addcommit () { |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
10 echo $1 > $1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
11 hg add $1 |
8168
8766fee6f225
tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents:
7786
diff
changeset
|
12 hg commit -d "${2} 0" -m $1 |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
13 } |
6910 | 14 |
15 commit () { | |
8168
8766fee6f225
tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents:
7786
diff
changeset
|
16 hg commit -d "${2} 0" -m $1 |
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 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
19 rm -rf a |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
20 hg init a |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
21 cd a |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
22 addcommit "C1" 0 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
23 addcommit "C2" 1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
24 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
25 cd .. |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
26 hg clone a b |
7786
92455c1d6f83
rebase: pull --rebase updates if there is nothing to rebase
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
27 # This is needed to test pull --rebase |
92455c1d6f83
rebase: pull --rebase updates if there is nothing to rebase
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
28 hg clone a c |
92455c1d6f83
rebase: pull --rebase updates if there is nothing to rebase
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
29 |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
30 cd b |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
31 addcommit "L1" 2 |
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 cd ../a |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
34 addcommit "R1" 3 |
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 cd ../b |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
37 echo |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
38 echo "% Now b has one revision to be pulled from a" |
11198
b345b1cc124f
rebase: use helpers.sh in tests
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
39 hg pull --rebase | hidebackup | sed -e 's/\(pulling from \).*/\1/' |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
40 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
41 hg glog --template '{rev}:{desc}\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 "% Re-run pull --rebase" |
11198
b345b1cc124f
rebase: use helpers.sh in tests
Matt Mackall <mpm@selenic.com>
parents:
10775
diff
changeset
|
45 hg pull --rebase | sed 's/\(pulling from \).*/\1/' |
6906
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 |
7786
92455c1d6f83
rebase: pull --rebase updates if there is nothing to rebase
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
48 echo "% Invoke pull --rebase and nothing to rebase" |
92455c1d6f83
rebase: pull --rebase updates if there is nothing to rebase
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
49 cd ../c |
92455c1d6f83
rebase: pull --rebase updates if there is nothing to rebase
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
50 hg pull --rebase 2>&1 | sed 's/\(pulling from \).*/\1/' |
92455c1d6f83
rebase: pull --rebase updates if there is nothing to rebase
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
51 hg glog --template '{rev}\n' -l 1 |
92455c1d6f83
rebase: pull --rebase updates if there is nothing to rebase
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
52 |
92455c1d6f83
rebase: pull --rebase updates if there is nothing to rebase
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
53 echo |
8242
aee8455ee8ec
Fix typeerror when specifying both --rebase and --pull
Martijn Pieters <mj@zopatista.com>
parents:
7786
diff
changeset
|
54 echo "% pull --rebase --update should ignore --update" |
aee8455ee8ec
Fix typeerror when specifying both --rebase and --pull
Martijn Pieters <mj@zopatista.com>
parents:
7786
diff
changeset
|
55 hg pull --rebase --update 2>&1 | sed 's/\(pulling from \).*/\1/' |
aee8455ee8ec
Fix typeerror when specifying both --rebase and --pull
Martijn Pieters <mj@zopatista.com>
parents:
7786
diff
changeset
|
56 |
aee8455ee8ec
Fix typeerror when specifying both --rebase and --pull
Martijn Pieters <mj@zopatista.com>
parents:
7786
diff
changeset
|
57 echo |
7786
92455c1d6f83
rebase: pull --rebase updates if there is nothing to rebase
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
58 echo "% pull --rebase doesn't update if nothing has been pulled" |
92455c1d6f83
rebase: pull --rebase updates if there is nothing to rebase
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
59 hg up 1 |
92455c1d6f83
rebase: pull --rebase updates if there is nothing to rebase
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
60 hg pull --rebase 2>&1 | sed 's/\(pulling from \).*/\1/' |
92455c1d6f83
rebase: pull --rebase updates if there is nothing to rebase
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6910
diff
changeset
|
61 hg glog --template '{rev}\n' -l 1 |
6906
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 exit 0 |