mercurial/patch.py
changeset 6531 c2c4fa9af016
parent 6470 ac0bcd951c2c
parent 6520 ba0b2dacc623
child 6532 833be17000b6
equal deleted inserted replaced
6530:4b92591c69a7 6531:c2c4fa9af016
   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))