mercurial/templatefilters.py
changeset 36246 9ee10b3284da
parent 35751 6d65cef5b038
child 36497 b2e54b257832
--- a/mercurial/templatefilters.py	Sun Jan 07 11:21:25 2018 +0900
+++ b/mercurial/templatefilters.py	Sun Jan 07 12:09:33 2018 +0900
@@ -100,6 +100,13 @@
     """List or text. Returns the length as an integer."""
     return len(i)
 
+@templatefilter('dirname')
+def dirname(path):
+    """Any text. Treats the text as a path, and strips the last
+    component of the path after splitting by the path separator.
+    """
+    return os.path.dirname(path)
+
 @templatefilter('domain')
 def domain(author):
     """Any text. Finds the first string that looks like an email