mercurial/patch.py
changeset 6520 ba0b2dacc623
parent 6467 65029a3aafc2
child 6531 c2c4fa9af016
child 6791 bbd89c9e6012
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))