##// END OF EJS Templates
templatefilters: rename commonprefix to commondir...
templatefilters: rename commonprefix to commondir Two reasons: * It makes it clearer that it's not a generic common string prefix (e.g. commonprefix(["bar", "baz"]) is not "ba", but "") * If we ever want a filter for generic common string prefix, then the name is now available for that. "commondir" does not describe the prefix-ness, however. I'm happy to rename it "commondirprefix" or "commonprefixdir" if others prefer. Differential Revision: https://phab.mercurial-scm.org/D3731

File last commit:

r38323:fabfbbf4 default
r38323:fabfbbf4 default
Show More
test-template-filters.t
23 lines | 828 B | text/troff | Tads3Lexer
/ tests / test-template-filters.t
$ hg debugtemplate '{""|splitlines|commondir}\n'
$ hg debugtemplate '{"foo/bar\nfoo/baz\nfoo/foobar\n"|splitlines|commondir}\n'
foo
$ hg debugtemplate '{"foo/bar\nfoo/bar\n"|splitlines|commondir}\n'
foo
$ hg debugtemplate '{"/foo/bar\n/foo/bar\n"|splitlines|commondir}\n'
foo
$ hg debugtemplate '{"/foo\n/foo\n"|splitlines|commondir}\n'
$ hg debugtemplate '{"foo/bar\nbar/baz"|splitlines|commondir}\n'
$ hg debugtemplate '{"foo/bar\nbar/baz\nbar/foo\n"|splitlines|commondir}\n'
$ hg debugtemplate '{"foo/../bar\nfoo/bar"|splitlines|commondir}\n'
foo
$ hg debugtemplate '{"foo\n/foo"|splitlines|commondir}\n'
$ hg init
$ hg log -r null -T '{rev|commondir}'
hg: parse error: argument is not a list of text
(template filter 'commondir' is not compatible with keyword 'rev')
[255]