[PATCH 3 of 5] Add util.splitpath() and use it instead of using split() directly

Shun-ichi GOTO shunichi.goto at gmail.com
Mon Jan 7 21:03:09 CST 2008


2008/1/8, Matt Mackall <mpm at selenic.com>:
>
> On Sun, 2008-01-06 at 21:26 +0900, Shun-ichi Goto wrote:
> > # HG changeset patch
> > # User Shun-ichi GOTO <shunichi.goto at gmail.com>
> > # Date 1199621785 -32400
> > # Node ID e7739db328e05cf824c8d5f3bf6d694e15bb0d02
> > # Parent  43ff7c5ed8446a721a7bad5655ddd59f8fc62e7b
> > Add util.splitpath() and use it instead of using split() directly.
> >
> > This is required for workaround of 0x5c issue.
> >
> > +def splitpath(path):
> > +    '''Split path by os.sep with supporting mbcs local encoding.'''
> > +    return path.split(os.sep)
> > +
>
> Confused, how does this do anything with mbcs? Also, given 2 of 2, what
> about os.altsep?

This function (and util.endswithsep()) themself do nothing for mbcs.
It is inteded to be wrapped by [patch 5 of 5].
# ah, it should be described so

About os.altsep, I could not decide to use it.
I've just replaced a part in code using os.sep and '\\'.

To consider os.altsep,
Is it better to be like "def splitpath(path, sep=os.sep):"?
Or split by both os.sep and os.altsep?

-- 
Shun-ichi GOTO


More information about the Mercurial-devel mailing list