filemerge: A feature request

Bryan O'Sullivan bos at serpentine.com
Fri Feb 8 15:38:04 CST 2008


Alexis S. L. Carvalho wrote:

> What's the problem with interpolations?

They steal the precious "%" character and put it to obscure use.  Unless
you're a Python hacker and know that the config files are implemented
using ConfigParser, that behaviour is surprising.

> A long, long time ago, when "hg push" didn't fall back to "default" when
> "default-push" wasn't set, a trick that was often recommended was to put
> something like this in ~/.hgrc:
> 
> [paths]
> default-push = %(default)s

We interpolate stuff like this already on the command line.  All we need
to do is keep replacing an RHS with an LHS until we no longer have an
LHS, then use the literal text that remains.  For example:

[paths]
foo = bar
bar = quux
quux = zoob
zoob = http://www.example.com/
default-push = foo

One could expect "default-push" to be replaced with
"http://www.example.com/".  This is simple, comprehensible, can be used
in restricted places, and doesn't introduce obscurities of Python's
string interpolation syntax into a program that otherwise hides its
Python heritage from all but power users.

	<b


More information about the Mercurial-devel mailing list