# HG changeset patch # User Mads Kiilerich # Date 2010-04-26 11:21:02 # Node ID 4fe28bdc27be896bcb2828552e3d3793160b5c89 # Parent 17cf756ba25d2b33858293aa103109f9b35bc56e patch: make "unable to strip away" message less confusing diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -910,16 +910,17 @@ def parsefilename(str): 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] == '/':