Submitter | Sean Farley |
---|---|
Date | April 18, 2013, 9:01 p.m. |
Message ID | <b657a963876cb670bb00.1366318890@laptop.local> |
Download | mbox | patch |
Permalink | /patch/1442/ |
State | Accepted |
Commit | d8d548d868d3ad6eb0d43ed48c9762dde1fe2657 |
Headers | show |
Comments
On Thu, 2013-04-18 at 16:01 -0500, Sean Farley wrote: > # HG changeset patch > # User Sean Farley <sean.michael.farley@gmail.com> > # Date 1365640069 18000 > # Wed Apr 10 19:27:49 2013 -0500 > # Node ID b657a963876cb670bb003ec4c1cacce3189b2055 > # Parent 63a783d1ac852d60e60669b2f8551a9b26de2947 > template: call runtemplate on the src argument to sub I've queued this one for default. Don't really want the churn in 2 for today.
Patch
diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -249,10 +249,12 @@ raise error.ParseError(_("sub expects three arguments")) pat = stringify(args[0][0](context, mapping, args[0][1])) rpl = stringify(args[1][0](context, mapping, args[1][1])) src = stringify(args[2][0](context, mapping, args[2][1])) + src = stringify(runtemplate(context, mapping, + compiletemplate(src, context))) yield re.sub(pat, rpl, src) def if_(context, mapping, args): if not (2 <= len(args) <= 3): # i18n: "if" is a keyword diff --git a/tests/test-command-template.t b/tests/test-command-template.t --- a/tests/test-command-template.t +++ b/tests/test-command-template.t @@ -1529,5 +1529,9 @@ Test new-style inline templating: $ hg log -R latesttag -r tip --template 'modified files: {file_mods % " {file}\n"}\n' modified files: .hgtags +Test the sub function of templating for expansion: + + $ hg log -R latesttag -r 10 --template '{sub("[0-9]", "x", "{rev}")}\n' + xx