Patchwork [3,of,6] vfs: add basename

login
register
mail settings
Submitter Katsunori FUJIWARA
Date July 9, 2015, 4:03 p.m.
Message ID <ceb578e671c08195b268.1436457780@juju>
Download mbox | patch
Permalink /patch/9940/
State Accepted
Headers show

Comments

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

Patch

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)