D3439: templatefilters: add commonprefix

Yuya Nishihara yuya at tcha.org
Wed Jun 13 08:19:58 EDT 2018


>   > `commondir()` would be fine as well. `commonpath()` doesn't feel better. I'm ambivalent about either nam>
>   I'd vote for changing it then. Both because I think it might make it clearer that it's the common prefix of "foo/bar" and "food" is not "foo" and because, as I said, we might want such a function later and it would be unfortunate if the name was taken. Btw, I just checked and we already have `dirname()` and `stripdir()` functions that would match `commondir()`.

+1 for `commondir()`. It matches the actual behavior, which is the last filename
part is always stripped.


More information about the Mercurial-devel mailing list