annotate tests/test-issue436 @ 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 f9567a7fa3b3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3745
68cddfbbe737 add test for issue436
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
1 #!/bin/sh
68cddfbbe737 add test for issue436
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
2
68cddfbbe737 add test for issue436
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
3 hg init a
68cddfbbe737 add test for issue436
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
4 cd a
3749
f9567a7fa3b3 additional fixes for issue436
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3745
diff changeset
5 hg -v log -v
3745
68cddfbbe737 add test for issue436
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
6 hg -v log -v x
68cddfbbe737 add test for issue436
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
7 true