comparison mercurial/dirstate.py @ 5843:83c354c4d529

Add endswithsep() and use it instead of using os.sep and os.altsep directly. This change is intended to allow hooking endswithsep() by win32mbcs extension for MBCS support.
author Shun-ichi GOTO <shunichi.goto@gmail.com>
date Wed, 09 Jan 2008 21:30:35 +0900
parents 111ed8c871bf
children d0576d065993
comparison
equal deleted inserted replaced
5842:111ed8c871bf 5843:83c354c4d529
72 def getcwd(self): 72 def getcwd(self):
73 cwd = os.getcwd() 73 cwd = os.getcwd()
74 if cwd == self._root: return '' 74 if cwd == self._root: return ''
75 # self._root ends with a path separator if self._root is '/' or 'C:\' 75 # self._root ends with a path separator if self._root is '/' or 'C:\'
76 rootsep = self._root 76 rootsep = self._root
77 if not rootsep.endswith(os.sep): 77 if not util.endswithsep(rootsep):
78 rootsep += os.sep 78 rootsep += os.sep
79 if cwd.startswith(rootsep): 79 if cwd.startswith(rootsep):
80 return cwd[len(rootsep):] 80 return cwd[len(rootsep):]
81 else: 81 else:
82 # we're outside the repo. return an absolute path. 82 # we're outside the repo. return an absolute path.
408 imatch = match 408 imatch = match
409 ignore = util.never 409 ignore = util.never
410 410
411 # self._root may end with a path separator when self._root == '/' 411 # self._root may end with a path separator when self._root == '/'
412 common_prefix_len = len(self._root) 412 common_prefix_len = len(self._root)
413 if not self._root.endswith(os.sep): 413 if not util.endswithsep(self._root):
414 common_prefix_len += 1 414 common_prefix_len += 1
415 415
416 normpath = util.normpath 416 normpath = util.normpath
417 listdir = osutil.listdir 417 listdir = osutil.listdir
418 lstat = os.lstat 418 lstat = os.lstat