Mercurial > public > mercurial-scm > hg
comparison mercurial/patch.py @ 6520:ba0b2dacc623
fix import with -p0
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Sat, 12 Apr 2008 22:41:07 -0400 |
parents | 65029a3aafc2 |
children | c2c4fa9af016 bbd89c9e6012 |
comparison
equal
deleted
inserted
replaced
6519:a7582980d654 | 6520:ba0b2dacc623 |
---|---|
787 def selectfile(afile_orig, bfile_orig, hunk, strip, reverse): | 787 def selectfile(afile_orig, bfile_orig, hunk, strip, reverse): |
788 def pathstrip(path, count=1): | 788 def pathstrip(path, count=1): |
789 pathlen = len(path) | 789 pathlen = len(path) |
790 i = 0 | 790 i = 0 |
791 if count == 0: | 791 if count == 0: |
792 return path.rstrip() | 792 return '', path.rstrip() |
793 while count > 0: | 793 while count > 0: |
794 i = path.find('/', i) | 794 i = path.find('/', i) |
795 if i == -1: | 795 if i == -1: |
796 raise PatchError(_("unable to strip away %d dirs from %s") % | 796 raise PatchError(_("unable to strip away %d dirs from %s") % |
797 (count, path)) | 797 (count, path)) |