[PATCH 0 of 5] Patches and new win32mbcs extension

Shun-ichi GOTO shunichi.goto at gmail.com
Thu Feb 14 10:23:01 CST 2008


2008/2/14, Alexis S. L. Carvalho <alexis at cecm.usp.br>:
> >  1) (first 4 patches)
>  >     Remove/alternate codes using os.sep to use existing/new functions.
>  >     These change is intended to allow to be hooked by win32mbcs extension.
>  >
>  >     For example:
>  >        s.replace('\\', '/') => util.normpath(s)  ... use existing function
>
>
> Would it be enough to use util.pconvert instead of normpath?  You did
>  wrap pconvert (through splitpath), pconvert is the more natural
>  equivalent of that s.replace(...) and some places may not want/need
>  normalization.

Ah, you are comletely right. I agree with side effect of using util.normpath().
I don't remember why I choose using util.normpath()...
# maybe by a historical reason of my patch work.


>  >        s.split(os.sep) => util.splitpath(s)      ... use new function
>  >        s.endswith(os.sep) => util.endswithsep(s) ... use new function
>
>
> Can I assume this piece of code works as an alternative to os.path.join?
>
>  def join(root, name):
>     if not util.endswithsep(root):
>         root += os.sep
>     return root + filename
>
>  os.lstat(join(root, name))

Yes if 'root' and 'name' is local path string (not pconert()'ed)
If so, however, I guess there's no need to define new join().

-- 
Shun-ichi GOTO


More information about the Mercurial-devel mailing list