##// END OF EJS Templates
Add endswithsep() and use it instead of using os.sep and os.altsep directly....
Shun-ichi GOTO -
r5843:83c354c4 default
parent child Browse files
Show More
@@ -462,7 +462,7 b' def copy(ui, repo, pats, opts, rename=Fa'
462 462 if len(pats) > 1 or util.patkind(pats[0], None)[0]:
463 463 raise util.Abort(_('with multiple sources, destination must be an '
464 464 'existing directory'))
465 if dest.endswith(os.sep) or os.altsep and dest.endswith(os.altsep):
465 if util.endswithsep(dest):
466 466 raise util.Abort(_('destination %s is not a directory') % dest)
467 467
468 468 tfn = targetpathfn
@@ -74,7 +74,7 b' class dirstate(object):'
74 74 if cwd == self._root: return ''
75 75 # self._root ends with a path separator if self._root is '/' or 'C:\'
76 76 rootsep = self._root
77 if not rootsep.endswith(os.sep):
77 if not util.endswithsep(rootsep):
78 78 rootsep += os.sep
79 79 if cwd.startswith(rootsep):
80 80 return cwd[len(rootsep):]
@@ -410,7 +410,7 b' class dirstate(object):'
410 410
411 411 # self._root may end with a path separator when self._root == '/'
412 412 common_prefix_len = len(self._root)
413 if not self._root.endswith(os.sep):
413 if not util.endswithsep(self._root):
414 414 common_prefix_len += 1
415 415
416 416 normpath = util.normpath
@@ -341,7 +341,7 b' def canonpath(root, cwd, myname):'
341 341 """return the canonical path of myname, given cwd and root"""
342 342 if root == os.sep:
343 343 rootsep = os.sep
344 elif root.endswith(os.sep):
344 elif endswithsep(root):
345 345 rootsep = root
346 346 else:
347 347 rootsep = root + os.sep
@@ -882,6 +882,10 b' def needbinarypatch():'
882 882 """return True if patches should be applied in binary mode by default."""
883 883 return os.name == 'nt'
884 884
885 def endswithsep(path):
886 '''Check path ends with os.sep or os.altsep.'''
887 return path.endswith(os.sep) or os.altsep and path.endswith(os.altsep)
888
885 889 # Platform specific variants
886 890 if os.name == 'nt':
887 891 import msvcrt
General Comments 0
You need to be logged in to leave comments. Login now