Mercurial > hg
annotate tests/test-encode.out @ 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 | a474f950357b |
children |
rev | line source |
---|---|
1258 | 1 %% no changes |
2 %% no changes | |
10211
a474f950357b
Update test and man page for multiple matching encode/decode filters
Mads Kiilerich <mads@kiilerich.com>
parents:
6093
diff
changeset
|
3 %% check contents in repo are encoded |
a474f950357b
Update test and man page for multiple matching encode/decode filters
Mads Kiilerich <mads@kiilerich.com>
parents:
6093
diff
changeset
|
4 this is a test |
a474f950357b
Update test and man page for multiple matching encode/decode filters
Mads Kiilerich <mads@kiilerich.com>
parents:
6093
diff
changeset
|
5 THIS IS A TEST |
a474f950357b
Update test and man page for multiple matching encode/decode filters
Mads Kiilerich <mads@kiilerich.com>
parents:
6093
diff
changeset
|
6 %% check committed content was decoded |
1258 | 7 this is a test |
8 this is a test | |
10211
a474f950357b
Update test and man page for multiple matching encode/decode filters
Mads Kiilerich <mads@kiilerich.com>
parents:
6093
diff
changeset
|
9 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
a474f950357b
Update test and man page for multiple matching encode/decode filters
Mads Kiilerich <mads@kiilerich.com>
parents:
6093
diff
changeset
|
10 %% check decoding of our new working dir copy |
a474f950357b
Update test and man page for multiple matching encode/decode filters
Mads Kiilerich <mads@kiilerich.com>
parents:
6093
diff
changeset
|
11 this is a test |
1258 | 12 this is a test |
6093
f5b00b6e426a
Option --decode for hg cat to apply decode filters.
Jesse Glick <jesse.glick@sun.com>
parents:
2175
diff
changeset
|
13 %% check hg cat operation |
f5b00b6e426a
Option --decode for hg cat to apply decode filters.
Jesse Glick <jesse.glick@sun.com>
parents:
2175
diff
changeset
|
14 this is a test |
f5b00b6e426a
Option --decode for hg cat to apply decode filters.
Jesse Glick <jesse.glick@sun.com>
parents:
2175
diff
changeset
|
15 this is a test |
f5b00b6e426a
Option --decode for hg cat to apply decode filters.
Jesse Glick <jesse.glick@sun.com>
parents:
2175
diff
changeset
|
16 this is a test |
f5b00b6e426a
Option --decode for hg cat to apply decode filters.
Jesse Glick <jesse.glick@sun.com>
parents:
2175
diff
changeset
|
17 this is a test |