mercurial/patch.py
changeset 4903 020ee9c781cf
parent 4900 e56c7e05c7e6
child 4904 59b8ff35c4ed
equal deleted inserted replaced
4902:8a53b39cd402 4903:020ee9c781cf
   775         pathlen = len(path)
   775         pathlen = len(path)
   776         i = 0
   776         i = 0
   777         if count == 0:
   777         if count == 0:
   778             return path.rstrip()
   778             return path.rstrip()
   779         while count > 0:
   779         while count > 0:
   780             i = path.find(os.sep, i)
   780             i = path.find('/', i)
   781             if i == -1:
   781             if i == -1:
   782                 raise PatchError(_("unable to strip away %d dirs from %s") %
   782                 raise PatchError(_("unable to strip away %d dirs from %s") %
   783                                  (count, path))
   783                                  (count, path))
   784             i += 1
   784             i += 1
   785             # consume '//' in the path
   785             # consume '//' in the path
   786             while i < pathlen - 1 and path[i] == os.sep:
   786             while i < pathlen - 1 and path[i] == '/':
   787                 i += 1
   787                 i += 1
   788             count -= 1
   788             count -= 1
   789         return path[i:].rstrip()
   789         return path[i:].rstrip()
   790 
   790 
   791     nulla = afile_orig == "/dev/null"
   791     nulla = afile_orig == "/dev/null"