D3439: templatefilters: add commonprefix
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Tue Jun 12 17:50:49 EDT 2018
martinvonz added a comment.
In https://phab.mercurial-scm.org/D3439#58410, @joerg.sonnenberger wrote:
> In https://phab.mercurial-scm.org/D3439#58405, @martinvonz wrote:
>
> > Do you think we should call it `commonpath()` or `commondir()` instead in case we want `commonprefix()` to work for any string in the future (and not care about path separators)?
>
>
> `commondir()` would be fine as well. `commonpath()` doesn't feel better. I'm ambivalent about either name.
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()`.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D3439
To: joerg.sonnenberger, #hg-reviewers
Cc: martinvonz, yuja, mercurial-devel
More information about the Mercurial-devel
mailing list