Mercurial > public > mercurial-scm > hg-stable
diff mercurial/templatefilters.py @ 38313:fabfbbf4dee2
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
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 13 Jun 2018 14:28:39 -0700 |
parents | 74b4a54002ec |
children | e7aa113b14f7 |
line wrap: on
line diff
--- a/mercurial/templatefilters.py Wed Jun 13 10:24:44 2018 -0400 +++ b/mercurial/templatefilters.py Wed Jun 13 14:28:39 2018 -0700 @@ -99,8 +99,8 @@ """ return os.path.basename(path) -@templatefilter('commonprefix') -def commonprefix(filelist): +@templatefilter('commondir') +def commondir(filelist): """List of text. Treats each list item as file name with / as path separator and returns the longest common directory prefix shared by all list items.