##// END OF EJS Templates
templatefilters: add commonprefix...
templatefilters: add commonprefix The commonprefix filter takes a list of files names like files() and returns the longest directory name common to all elements. Differential Revision: https://phab.mercurial-scm.org/D3439

File last commit:

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