Mercurial > hg
annotate tests/test-convert-darcs @ 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 | bb5ea66789e3 |
children | 4481f8a93c7a |
rev | line source |
---|---|
5413 | 1 #!/bin/sh |
2 | |
3 "$TESTDIR/hghave" darcs || exit 80 | |
4 | |
5 echo "[extensions]" >> $HGRCPATH | |
6 echo "convert=" >> $HGRCPATH | |
10119
bb5ea66789e3
tests: load with "ext =" instead of "hgext.ext ="
Martin Geisler <mg@lazybytes.net>
parents:
9527
diff
changeset
|
7 echo 'graphlog =' >> $HGRCPATH |
5413 | 8 |
9 DARCS_EMAIL='test@example.org'; export DARCS_EMAIL | |
9326
b236f34ec1e9
Fix failing darcs test
Bryan O'Sullivan <bos@serpentine.com>
parents:
8523
diff
changeset
|
10 HOME=`pwd`/do_not_use_HOME_darcs; export HOME |
5413 | 11 |
5520
cc3af86ab6fe
test-convert-darcs: skip if we can't find the elementtree module
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5442
diff
changeset
|
12 # skip if we can't import elementtree |
cc3af86ab6fe
test-convert-darcs: skip if we can't find the elementtree module
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5442
diff
changeset
|
13 mkdir dummy |
cc3af86ab6fe
test-convert-darcs: skip if we can't find the elementtree module
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5442
diff
changeset
|
14 mkdir dummy/_darcs |
cc3af86ab6fe
test-convert-darcs: skip if we can't find the elementtree module
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5442
diff
changeset
|
15 if hg convert dummy 2>&1 | grep ElementTree > /dev/null; then |
5685
57d29a45ffbc
Use skipped: instead of hghave: for skipping tests, use this in test-merge-types
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5667
diff
changeset
|
16 echo 'skipped: missing feature: elementtree module' |
5520
cc3af86ab6fe
test-convert-darcs: skip if we can't find the elementtree module
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5442
diff
changeset
|
17 exit 80 |
cc3af86ab6fe
test-convert-darcs: skip if we can't find the elementtree module
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5442
diff
changeset
|
18 fi |
cc3af86ab6fe
test-convert-darcs: skip if we can't find the elementtree module
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5442
diff
changeset
|
19 |
5413 | 20 echo % initialize darcs repo |
21 mkdir darcs-repo | |
22 cd darcs-repo | |
23 darcs init | |
24 echo a > a | |
25 darcs record -a -l -m p0 | |
26 cd .. | |
27 | |
28 echo % branch and update | |
5667
f29b7c8419cb
Fix test-convert-darcs output on Debian etch (issue779)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5520
diff
changeset
|
29 darcs get darcs-repo darcs-clone >/dev/null |
5413 | 30 cd darcs-clone |
31 echo c >> a | |
32 echo c > c | |
33 darcs record -a -l -m p1.1 | |
34 cd .. | |
35 | |
36 echo % update source | |
37 cd darcs-repo | |
38 echo b >> a | |
39 echo b > b | |
40 darcs record -a -l -m p1.2 | |
41 | |
42 echo % merge branch | |
43 darcs pull -a ../darcs-clone | |
9326
b236f34ec1e9
Fix failing darcs test
Bryan O'Sullivan <bos@serpentine.com>
parents:
8523
diff
changeset
|
44 sleep 1 |
5413 | 45 echo e > a |
9526
457a30ed8ffb
convert/darcs: fix file renaming (issue1853)
Patrick Mezard <pmezard@gmail.com>
parents:
9326
diff
changeset
|
46 echo f > f |
9527
b3c13e721593
convert/darcs: handle directory renaming
Patrick Mezard <pmezard@gmail.com>
parents:
9526
diff
changeset
|
47 mkdir dir |
b3c13e721593
convert/darcs: handle directory renaming
Patrick Mezard <pmezard@gmail.com>
parents:
9526
diff
changeset
|
48 echo d > dir/d |
b3c13e721593
convert/darcs: handle directory renaming
Patrick Mezard <pmezard@gmail.com>
parents:
9526
diff
changeset
|
49 echo d > dir/d2 |
5413 | 50 darcs record -a -l -m p2 |
9526
457a30ed8ffb
convert/darcs: fix file renaming (issue1853)
Patrick Mezard <pmezard@gmail.com>
parents:
9326
diff
changeset
|
51 |
457a30ed8ffb
convert/darcs: fix file renaming (issue1853)
Patrick Mezard <pmezard@gmail.com>
parents:
9326
diff
changeset
|
52 echo % test file and directory move |
457a30ed8ffb
convert/darcs: fix file renaming (issue1853)
Patrick Mezard <pmezard@gmail.com>
parents:
9326
diff
changeset
|
53 darcs mv f ff |
9527
b3c13e721593
convert/darcs: handle directory renaming
Patrick Mezard <pmezard@gmail.com>
parents:
9526
diff
changeset
|
54 # Test remove + move |
b3c13e721593
convert/darcs: handle directory renaming
Patrick Mezard <pmezard@gmail.com>
parents:
9526
diff
changeset
|
55 darcs remove dir/d2 |
b3c13e721593
convert/darcs: handle directory renaming
Patrick Mezard <pmezard@gmail.com>
parents:
9526
diff
changeset
|
56 rm dir/d2 |
b3c13e721593
convert/darcs: handle directory renaming
Patrick Mezard <pmezard@gmail.com>
parents:
9526
diff
changeset
|
57 darcs mv dir dir2 |
9526
457a30ed8ffb
convert/darcs: fix file renaming (issue1853)
Patrick Mezard <pmezard@gmail.com>
parents:
9326
diff
changeset
|
58 darcs record -a -l -m p3 |
5413 | 59 cd .. |
60 | |
61 glog() | |
62 { | |
8523
5b7da468531b
tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents:
7425
diff
changeset
|
63 hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@" |
5413 | 64 } |
65 | |
9326
b236f34ec1e9
Fix failing darcs test
Bryan O'Sullivan <bos@serpentine.com>
parents:
8523
diff
changeset
|
66 hg convert darcs-repo darcs-repo-hg |
5413 | 67 # The converter does not currently handle patch conflicts very well. |
68 # When they occur, it reverts *all* changes and moves forward, | |
69 # letting the conflict resolving patch fix collisions. | |
70 # Unfortunately, non-conflicting changes, like the addition of the | |
71 # "c" file in p1.1 patch are reverted too. | |
72 # Just to say that manifest not listing "c" here is a bug. | |
73 glog -R darcs-repo-hg | |
6799
12d1e1e79faf
Fix tests failures introduced by 7239e06e58e9
Patrick Mezard <pmezard@gmail.com>
parents:
5685
diff
changeset
|
74 hg up -q -R darcs-repo-hg |
5413 | 75 hg -R darcs-repo-hg manifest --debug |