# HG changeset patch # User Augie Fackler # Date 2015-05-26 18:41:00 # Node ID 127a11f705d97a6f0245d6b6b8f85f18f16f3d87 # Parent 46f2df2f0680ee6dcee9d1a3a167b9e30be35628 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. diff --git a/mercurial/pathutil.py b/mercurial/pathutil.py --- a/mercurial/pathutil.py +++ b/mercurial/pathutil.py @@ -188,52 +188,8 @@ def normasprefix(path): 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