Show More
@@ -462,7 +462,7 def copy(ui, repo, pats, opts, rename=Fa | |||||
462 | if len(pats) > 1 or util.patkind(pats[0], None)[0]: |
|
462 | if len(pats) > 1 or util.patkind(pats[0], None)[0]: | |
463 | raise util.Abort(_('with multiple sources, destination must be an ' |
|
463 | raise util.Abort(_('with multiple sources, destination must be an ' | |
464 | 'existing directory')) |
|
464 | 'existing directory')) | |
465 | if dest.endswith(os.sep) or os.altsep and dest.endswith(os.altsep): |
|
465 | if util.endswithsep(dest): | |
466 | raise util.Abort(_('destination %s is not a directory') % dest) |
|
466 | raise util.Abort(_('destination %s is not a directory') % dest) | |
467 |
|
467 | |||
468 | tfn = targetpathfn |
|
468 | tfn = targetpathfn |
@@ -74,7 +74,7 class dirstate(object): | |||||
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 |
|
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):] | |
@@ -410,7 +410,7 class dirstate(object): | |||||
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 |
|
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 |
@@ -341,7 +341,7 def canonpath(root, cwd, myname): | |||||
341 | """return the canonical path of myname, given cwd and root""" |
|
341 | """return the canonical path of myname, given cwd and root""" | |
342 | if root == os.sep: |
|
342 | if root == os.sep: | |
343 | rootsep = os.sep |
|
343 | rootsep = os.sep | |
344 |
elif root |
|
344 | elif endswithsep(root): | |
345 | rootsep = root |
|
345 | rootsep = root | |
346 | else: |
|
346 | else: | |
347 | rootsep = root + os.sep |
|
347 | rootsep = root + os.sep | |
@@ -882,6 +882,10 def needbinarypatch(): | |||||
882 | """return True if patches should be applied in binary mode by default.""" |
|
882 | """return True if patches should be applied in binary mode by default.""" | |
883 | return os.name == 'nt' |
|
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 | # Platform specific variants |
|
889 | # Platform specific variants | |
886 | if os.name == 'nt': |
|
890 | if os.name == 'nt': | |
887 | import msvcrt |
|
891 | import msvcrt |
General Comments 0
You need to be logged in to leave comments.
Login now