Mercurial > hg
annotate tests/test-clone-update-order @ 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 | 7ce62865d72a |
children |
rev | line source |
---|---|
10637
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
1 #!/bin/sh |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
2 |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
3 echo |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
4 echo % prepare repo a |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
5 mkdir a |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
6 cd a |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
7 hg init |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
8 echo foo > bar |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
9 hg commit -Am default |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
10 hg up -r null |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
11 hg branch mine |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
12 echo hello > world |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
13 hg commit -Am hello |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
14 hg up -r null |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
15 hg branch other |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
16 echo good > bye |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
17 hg commit -Am other |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
18 hg up -r mine |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
19 |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
20 echo % test -U -u |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
21 hg clone -U -u . .#other ../b -r 0 -r 1 -r 2 -b other |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
22 |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
23 echo % test -U |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
24 hg clone -U .#other ../b -r 0 -r 1 -r 2 -b other |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
25 rm -rf ../b |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
26 |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
27 echo % test -u . |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
28 hg clone -u . .#other ../b -r 0 -r 1 -r 2 -b other |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
29 rm -rf ../b |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
30 |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
31 echo % test -u 0 |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
32 hg clone -u 0 .#other ../b -r 0 -r 1 -r 2 -b other |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
33 rm -rf ../b |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
34 |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
35 echo % test -u 1 |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
36 hg clone -u 1 .#other ../b -r 0 -r 1 -r 2 -b other |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
37 rm -rf ../b |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
38 |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
39 echo % test -u 2 |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
40 hg clone -u 2 .#other ../b -r 0 -r 1 -r 2 -b other |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
41 rm -rf ../b |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
42 |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
43 echo % test -r 0 |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
44 hg clone -u 2 .#other ../b -r 0 -r 1 -r 2 -b other |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
45 rm -rf ../b |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
46 |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
47 echo % test -r mine ... mine is ignored |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
48 hg clone -u 2 .#other ../b -r mine -r 0 -r 1 -r 2 -b other |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
49 rm -rf ../b |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
50 |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
51 echo % test -b default |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
52 hg clone .#other ../b -b default -b mine |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
53 rm -rf ../b |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
54 |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
55 echo % test #other |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
56 hg clone .#other ../b |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
57 rm -rf ../b |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
58 |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
59 echo % test tip |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
60 hg clone -U . ../c -r 1 -r 2 > /dev/null |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
61 hg clone ../c ../b |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
62 rm -rf ../b ../c |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
63 cd .. |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
64 |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
65 rm -rf a |
7ce62865d72a
commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff
changeset
|
66 exit 0 |