changeset 11019:4fe28bdc27be

patch: make "unable to strip away" message less confusing
author Mads Kiilerich <mads@kiilerich.com>
date Mon, 26 Apr 2010 13:21:02 +0200
parents 17cf756ba25d
children dd157720a8ee
files mercurial/patch.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Mon Apr 26 13:21:02 2010 +0200
+++ b/mercurial/patch.py	Mon Apr 26 13:21:02 2010 +0200
@@ -910,16 +910,17 @@
     return s[:i]
 
 def selectfile(afile_orig, bfile_orig, hunk, strip):
-    def pathstrip(path, count=1):
+    def pathstrip(path, strip):
         pathlen = len(path)
         i = 0
-        if count == 0:
+        if strip == 0:
             return '', path.rstrip()
+        count = strip
         while count > 0:
             i = path.find('/', i)
             if i == -1:
-                raise PatchError(_("unable to strip away %d dirs from %s") %
-                                 (count, path))
+                raise PatchError(_("unable to strip away %d of %d dirs from %s") %
+                                 (count, strip, path))
             i += 1
             # consume '//' in the path
             while i < pathlen - 1 and path[i] == '/':