view tests/test-relink.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 7914628b4751
children
line wrap: on
line source

% create source repository
adding a
adding b
% clone and pull to break links
requesting all changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 2 changes to 2 files
updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
created new head
% relink
relinking .hg/store
tip has 2 files, estimated total number of files: 3
collecting: 00changelog.i 1/3 files (33.33%)
collecting: 00manifest.i 2/3 files (66.67%)
collecting: a.i 3/3 files (100.00%)
collecting: b.i 4/3 files (133.33%)
collecting: dummy.i 5/3 files (166.67%)
collected 5 candidate storage files
not linkable: 00changelog.i
not linkable: 00manifest.i
pruning: data/a.i 3/5  files (60.00%)
not linkable: data/b.i
pruning: data/dummy.i 5/5  files (100.00%)
pruned down to 2 probably relinkable files
relinking: data/a.i 1/2  files (50.00%)
not linkable: data/dummy.i
relinked 1 files (136 bytes reclaimed)
% check hardlinks
repo/.hg/store/data/a.i == clone/.hg/store/data/a.i
repo/.hg/store/data/b.i != clone/.hg/store/data/b.i