D3439: templatefilters: add commonprefix

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Thu May 10 08:40:40 EDT 2018


yuja added a comment.


  > +  $ hg debugtemplate '{"foo/bar\nfoo/bar\n"|splitlines|commonprefix}\n'
  >  +  foo
  
  should be "foo/bar"
  
  > +  $ hg debugtemplate '{"/foo/bar\n/foo/bar\n"|splitlines|commonprefix}\n'
  >  +  foo
  
  should be "/foo/bar"
  
  > +  $ hg debugtemplate '{"/foo\n/foo\n"|splitlines|commonprefix}\n'
  >  +
  
  should e "/foo"
  
  FWIW, I doubt if scanning all elements with the seen set is faster than
  calling min()/max() to pick the farthest pair because Python is slow.
  
  > {str|commonprefix} is not really interesting since it is naturally an
  >  iterable of text.
  
  I think it's better to error out, but that could be addressed later.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3439

To: joerg.sonnenberger, #hg-reviewers
Cc: yuja, mercurial-devel


More information about the Mercurial-devel mailing list