[PATCH 3 of 4] Use os.path.split() for MBCS with win32mbcs extension

Shun-ichi Goto shunichi.goto at gmail.com
Thu Jul 9 08:57:37 CDT 2009


# HG changeset patch
# User Shun-ichi GOTO <shunichi.goto at gmail.com>
# Date 1247143159 -32400
# Node ID 4f506949b88f0562b3d9891775ea1e7265b0ac7c
# Parent  aaafb9723679d3ba5e010347ac276a9037408d47
Use os.path.split() for MBCS with win32mbcs extension.

diff -r aaafb9723679 -r 4f506949b88f mercurial/windows.py
--- a/mercurial/windows.py	Thu Jul 09 21:39:18 2009 +0900
+++ b/mercurial/windows.py	Thu Jul 09 21:39:19 2009 +0900
@@ -209,11 +209,9 @@
     dircache = {} # dirname -> filename -> status | None if file does not exist
     for nf in files:
         nf  = ncase(nf)
-        pos = nf.rfind(sep)
-        if pos == -1:
-            dir, base = '.', nf
-        else:
-            dir, base = nf[:pos+1], nf[pos+1:]
+        dir, base = os.path.split(nf)
+        if not dir:
+            dir = '.'
         cache = dircache.get(dir, None)
         if cache is None:
             try:


More information about the Mercurial-devel mailing list