view tests/test-diff-color.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 b8b4a2417fbd
children
line wrap: on
line source

adding a
% default context
diff -r cf9f4ba66af2 a
--- a/a
+++ b/a
@@ -2,7 +2,7 @@
 c
 a
 a
-b
+dd
 a
 a
 c
% --unified=2
diff -r cf9f4ba66af2 a
--- a/a
+++ b/a
@@ -3,5 +3,5 @@
 a
 a
-b
+dd
 a
 a
% diffstat
 a |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
% record
diff --git a/a b/a
old mode 100644
new mode 100755
1 hunks, 1 lines changed
examine changes to 'a'? [Ynsfdaq?] 
@@ -2,7 +2,7 @@
 c
 a
 a
-b
+dd
 a
 a
 c
record this change to 'a'? [Ynsfdaq?] 

rolling back to revision 0 (undo commit)
% qrecord
diff --git a/a b/a
old mode 100644
new mode 100755
1 hunks, 1 lines changed
examine changes to 'a'? [Ynsfdaq?] 
@@ -2,7 +2,7 @@
 c
 a
 a
-b
+dd
 a
 a
 c
record this change to 'a'? [Ynsfdaq?]