Commit Graph

11 Commits

Author SHA1 Message Date
Augie Fackler
8132db78d0 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.
2015-05-26 14:41:00 -04:00
Augie Fackler
98072a6fc9 pathutil: restate dirname and join as forwards to posixpath
I've done this as its own step so that it's easy to see that the
posixpath implementations pass the doctests in this package. In a
future patch I'll just make these pure forwards of the methods so that
things using pathutil can be oblivious to the posix nature of these
functions.
2015-05-26 14:30:48 -04:00
Durham Goode
43bd136581 pathutil: add dirname and join functions
This adds dirname and join functions to pathutil which are explicitly for
handling '/' delimited paths. The implementations are basically copy paste from
python's posix os.path.dirname and os.path.join functions.
2015-05-22 12:47:18 -07:00
Matt Mackall
a2d7016ad6 canonpath: fix infinite recursion 2015-05-12 19:40:45 -05:00
Matt Harbison
9085702dae pathutil: hint if a path is root relative instead of cwd relative (issue4663)
Given that this path is going to abort, it seems OK to spend the time to do an
alternate lookup to better inform the user.  The path returned by util.pathto()
ends with '/' at least in some cases, so os.path.relpath() is used instead,
which requires python 2.6.
2015-05-11 21:26:13 -04:00
Matt Mackall
0826b8e884 merge with stable 2014-12-18 16:41:59 -06:00
Matt Mackall
8b83dfc480 pathauditor: check for Windows shortname aliases 2014-12-18 14:18:28 -06:00
Augie Fackler
13206234f4 pathauditor: check for codepoints ignored on OS X 2014-12-16 13:08:17 -05:00
Mads Kiilerich
523c87c1fe spelling: fixes from proofreading of spell checker issues 2014-04-17 22:47:38 +02:00
FUJIWARA Katsunori
85d651396d subrepo: normalize path in the specific way for problematic encodings
Before this patch, "reporelpath()" uses "rstrip(os.sep)" to trim
"os.sep" at the end of "parent.root" path.

But it doesn't work correctly with some problematic encodings on
Windows, because some multi-byte characters in such encodings contain
'\\' (0x5c) as the tail byte of them.

In such cases, "reporelpath()" leaves unexpected '\\' at the beginning
of the path returned to callers.

"lcalrepository.root" seems not to have tail "os.sep", because it is
always normalized by "os.path.realpath()" in "vfs.__init__()", but in
fact it has tail "os.sep", if it is a root (of the drive): path
normalization trims tail "os.sep" off "/foo/bar/", but doesn't trim
one off "/".

So, just avoiding "rstrip(os.sep)" in "reporelpath()" causes
regression around issue3033 fixed by e3dfde137fa5.

This patch introduces "pathutil.normasprefix" to normalize specified
path in the specific way for problematic encodings without regression
around issue3033.
2014-05-08 19:03:00 +09:00
Augie Fackler
213fff305a pathutil: tease out a new library to break an import cycle from canonpath use 2013-11-06 18:19:04 -05:00