[PATCH 3 of 6] vfs: add basename

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Thu Jul 9 11:03:00 CDT 2015


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1436457591 -32400
#      Fri Jul 10 00:59:51 2015 +0900
# Node ID ceb578e671c08195b268451eb55e4db72f6d23c8
# Parent  02bc9a7f0e164d5ee898a35457861269e4a0d7fa
vfs: add basename

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -282,6 +282,12 @@ class abstractvfs(object):
         finally:
             fp.close()
 
+    def basename(self, path):
+        """return base element of a path (as os.path.basename would do)
+
+        This exists to allow handling of strange encoding if needed."""
+        return os.path.basename(path)
+
     def chmod(self, path, mode):
         return os.chmod(self.join(path), mode)
 


More information about the Mercurial-devel mailing list