pathutil: demote two local functions to just be forwards
authorAugie Fackler <augie@google.com>
Tue, 26 May 2015 14:41:00 -0400
changeset 25286 127a11f705d9
parent 25285 46f2df2f0680
child 25287 56eed3923dbc
pathutil: demote two local functions to just be forwards We retain the forwards because it helps code be more ignorant of implementation details, but use forwards instead of our own method definitions since we don't need any truly custom behavior for now.
mercurial/pathutil.py
--- a/mercurial/pathutil.py	Tue May 26 14:30:48 2015 -0400
+++ b/mercurial/pathutil.py	Tue May 26 14:41:00 2015 -0400
@@ -188,52 +188,8 @@
     else:
         return path
 
-def join(*args):
-    '''Join two or more pathname components, inserting '/' as needed.
-
-    Based on the posix os.path.join() implementation.
-
-    >>> join('foo', 'bar')
-    'foo/bar'
-    >>> join('/foo', 'bar')
-    '/foo/bar'
-    >>> join('foo', '/bar')
-    '/bar'
-    >>> join('foo', 'bar/')
-    'foo/bar/'
-    >>> join('foo', 'bar', 'gah')
-    'foo/bar/gah'
-    >>> join('foo')
-    'foo'
-    >>> join('', 'foo')
-    'foo'
-    >>> join('foo/', 'bar')
-    'foo/bar'
-    >>> join('', '', '')
-    ''
-    >>> join ('foo', '', '', 'bar')
-    'foo/bar'
-    '''
-    return posixpath.join(*args)
-
-def dirname(path):
-    '''returns the directory portion of the given path
-
-    Based on the posix os.path.split() implementation.
-
-    >>> dirname('foo')
-    ''
-    >>> dirname('foo/')
-    'foo'
-    >>> dirname('foo/bar')
-    'foo'
-    >>> dirname('/foo')
-    '/'
-    >>> dirname('/foo/bar')
-    '/foo'
-    >>> dirname('/foo//bar/poo')
-    '/foo//bar'
-    >>> dirname('/foo//bar')
-    '/foo'
-    '''
-    return posixpath.dirname(path)
+# forward two methods from posixpath that do what we need, but we'd
+# rather not let our internals know that we're thinking in posix terms
+# - instead we'll let them be oblivious.
+join = posixpath.join
+dirname = posixpath.dirname