Mercurial > public > mercurial-scm > hg-stable
diff mercurial/scmutil.py @ 23582:7559dc8c4238
vfs: add a 'split' method
This method has the same behavior as the 'os.path.split' function, but having
it in vfs will allow handling of tricky encoding situations in the future.
In the same patch, we replace the use of 'os.path.split' in the transaction code.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Mon, 15 Dec 2014 13:32:34 -0800 |
parents | aed981c7bebf |
children | 164915e8ef7b |
line wrap: on
line diff
--- a/mercurial/scmutil.py Mon Dec 15 13:27:46 2014 -0800 +++ b/mercurial/scmutil.py Mon Dec 15 13:32:34 2014 -0800 @@ -268,6 +268,12 @@ to allow handling of strange encoding if needed.""" return os.path.join(*paths) + def split(self, path): + """split top-most element of a path (as os.path.split would do) + + This exists to allow handling of strange encoding if needed.""" + return os.path.split(path) + def lexists(self, path=None): return os.path.lexists(self.join(path))