Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/patch.py @ 4922:020ee9c781cf
patch: fix normalized paths separators.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Tue, 17 Jul 2007 23:34:52 +0200 |
parents | e56c7e05c7e6 |
children | 59b8ff35c4ed |
comparison
equal
deleted
inserted
replaced
4921:8a53b39cd402 | 4922: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" |