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

Matt Mackall mpm at selenic.com
Tue Jan 8 10:56:23 CST 2008


[re-adding list]

On Tue, 2008-01-08 at 16:24 +0900, Shun-ichi GOTO wrote:
> 2008/1/8, Matt Mackall <mpm at selenic.com>:
> > Here's a big question that we have to answer with regard to MBCS: what
> > happens if you check in a path with a 0x5c on a shift-jis machine and I
> > check it out in ascii-land? I suspect the answer is: I get an extra
> > directory level and much confusion.
> 
> Is this question for the behaviour on patched mercurial?
> Or for current hg?
> 
> If former, the people in ascii-windows-land may gets confuzed
> by error.
> The pepole asii-unix-land people are good to play, no extra directory.
>  This is limitation of my patch
> first I described in [PATCH 0 of 5],  "effects and save local only".

How does it work? What byte sequence gets stored in the manifest?

> > And here's my thought: do it in an extension. And have the extension
> > override a bunch of the standard interfaces and make Mercurial think
> > your filesystem is actually in utf-8. Which does the following:
> >
> > - people with sensible charsets unaffected and (a) and (b) above
> just
> > work
> > - shift-jis and friends get stored in a format other people (and the
> > Mercurial internals!) can understand
> > - MBCS weirdness is well contained
> > - people who enable the extension will know that they're playing a
> > little outside of the box
> >
> > Sound feasible?
> 
> Good, I feel.
> And "make Mercurial think your filesystem is actually in utf-8"
> is the one I imagined as alternative proposal except using extension.
> I can try for that.
> 
> And I have a question.
> Making it as extesion, how to?
> 
> I imagined before, by overriding localreository class like mq does,
> but its not enough.  There are many place which should convert
> filenames between internal and local.  Add some extension point on
> every place accessing to fs like hook?  Or else?  Please tell me a
> implementation idea if you have.

a) do the os.sep and split cleanups like you already posted
b) in your extension, wrap the various built-ins and library functions
that report paths
c) add shift-jis <-> utf-8 to util.pconvert and util.localpath

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list