##// END OF EJS Templates
templatefilters: rename commonprefix to commondir...
Martin von Zweigbergk -
r38323:fabfbbf4 default
parent child Browse files
Show More
@@ -99,8 +99,8 b' def basename(path):'
99 """
99 """
100 return os.path.basename(path)
100 return os.path.basename(path)
101
101
102 @templatefilter('commonprefix')
102 @templatefilter('commondir')
103 def commonprefix(filelist):
103 def commondir(filelist):
104 """List of text. Treats each list item as file name with /
104 """List of text. Treats each list item as file name with /
105 as path separator and returns the longest common directory
105 as path separator and returns the longest common directory
106 prefix shared by all list items.
106 prefix shared by all list items.
@@ -1,23 +1,23 b''
1 $ hg debugtemplate '{""|splitlines|commonprefix}\n'
1 $ hg debugtemplate '{""|splitlines|commondir}\n'
2
2
3 $ hg debugtemplate '{"foo/bar\nfoo/baz\nfoo/foobar\n"|splitlines|commonprefix}\n'
3 $ hg debugtemplate '{"foo/bar\nfoo/baz\nfoo/foobar\n"|splitlines|commondir}\n'
4 foo
4 foo
5 $ hg debugtemplate '{"foo/bar\nfoo/bar\n"|splitlines|commonprefix}\n'
5 $ hg debugtemplate '{"foo/bar\nfoo/bar\n"|splitlines|commondir}\n'
6 foo
6 foo
7 $ hg debugtemplate '{"/foo/bar\n/foo/bar\n"|splitlines|commonprefix}\n'
7 $ hg debugtemplate '{"/foo/bar\n/foo/bar\n"|splitlines|commondir}\n'
8 foo
8 foo
9 $ hg debugtemplate '{"/foo\n/foo\n"|splitlines|commonprefix}\n'
9 $ hg debugtemplate '{"/foo\n/foo\n"|splitlines|commondir}\n'
10
10
11 $ hg debugtemplate '{"foo/bar\nbar/baz"|splitlines|commonprefix}\n'
11 $ hg debugtemplate '{"foo/bar\nbar/baz"|splitlines|commondir}\n'
12
12
13 $ hg debugtemplate '{"foo/bar\nbar/baz\nbar/foo\n"|splitlines|commonprefix}\n'
13 $ hg debugtemplate '{"foo/bar\nbar/baz\nbar/foo\n"|splitlines|commondir}\n'
14
14
15 $ hg debugtemplate '{"foo/../bar\nfoo/bar"|splitlines|commonprefix}\n'
15 $ hg debugtemplate '{"foo/../bar\nfoo/bar"|splitlines|commondir}\n'
16 foo
16 foo
17 $ hg debugtemplate '{"foo\n/foo"|splitlines|commonprefix}\n'
17 $ hg debugtemplate '{"foo\n/foo"|splitlines|commondir}\n'
18
18
19 $ hg init
19 $ hg init
20 $ hg log -r null -T '{rev|commonprefix}'
20 $ hg log -r null -T '{rev|commondir}'
21 hg: parse error: argument is not a list of text
21 hg: parse error: argument is not a list of text
22 (template filter 'commonprefix' is not compatible with keyword 'rev')
22 (template filter 'commondir' is not compatible with keyword 'rev')
23 [255]
23 [255]
General Comments 0
You need to be logged in to leave comments. Login now