Patchwork D3731: templatefilters: rename commonprefix to commondir

login
register
mail settings
Submitter phabricator
Date June 14, 2018, 11:19 a.m.
Message ID <cf4da2317ebc8af39c1c41ababb58e98@localhost.localdomain>
Download mbox | patch
Permalink /patch/32125/
State Not Applicable
Headers show

Comments

phabricator - June 14, 2018, 11:19 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGfabfbbf4dee2: templatefilters: rename commonprefix to commondir (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3731?vs=9055&id=9056

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

AFFECTED FILES
  mercurial/templatefilters.py
  tests/test-template-filters.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-template-filters.t b/tests/test-template-filters.t
--- a/tests/test-template-filters.t
+++ b/tests/test-template-filters.t
@@ -1,23 +1,23 @@ 
-  $ hg debugtemplate '{""|splitlines|commonprefix}\n'
+  $ hg debugtemplate '{""|splitlines|commondir}\n'
   
-  $ hg debugtemplate '{"foo/bar\nfoo/baz\nfoo/foobar\n"|splitlines|commonprefix}\n'
+  $ hg debugtemplate '{"foo/bar\nfoo/baz\nfoo/foobar\n"|splitlines|commondir}\n'
   foo
-  $ hg debugtemplate '{"foo/bar\nfoo/bar\n"|splitlines|commonprefix}\n'
+  $ hg debugtemplate '{"foo/bar\nfoo/bar\n"|splitlines|commondir}\n'
   foo
-  $ hg debugtemplate '{"/foo/bar\n/foo/bar\n"|splitlines|commonprefix}\n'
+  $ hg debugtemplate '{"/foo/bar\n/foo/bar\n"|splitlines|commondir}\n'
   foo
-  $ hg debugtemplate '{"/foo\n/foo\n"|splitlines|commonprefix}\n'
+  $ hg debugtemplate '{"/foo\n/foo\n"|splitlines|commondir}\n'
   
-  $ hg debugtemplate '{"foo/bar\nbar/baz"|splitlines|commonprefix}\n'
+  $ hg debugtemplate '{"foo/bar\nbar/baz"|splitlines|commondir}\n'
   
-  $ hg debugtemplate '{"foo/bar\nbar/baz\nbar/foo\n"|splitlines|commonprefix}\n'
+  $ hg debugtemplate '{"foo/bar\nbar/baz\nbar/foo\n"|splitlines|commondir}\n'
   
-  $ hg debugtemplate '{"foo/../bar\nfoo/bar"|splitlines|commonprefix}\n'
+  $ hg debugtemplate '{"foo/../bar\nfoo/bar"|splitlines|commondir}\n'
   foo
-  $ hg debugtemplate '{"foo\n/foo"|splitlines|commonprefix}\n'
+  $ hg debugtemplate '{"foo\n/foo"|splitlines|commondir}\n'
   
   $ hg init
-  $ hg log -r null -T '{rev|commonprefix}'
+  $ hg log -r null -T '{rev|commondir}'
   hg: parse error: argument is not a list of text
-  (template filter 'commonprefix' is not compatible with keyword 'rev')
+  (template filter 'commondir' is not compatible with keyword 'rev')
   [255]
diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py
--- a/mercurial/templatefilters.py
+++ b/mercurial/templatefilters.py
@@ -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.