# HG changeset patch # User Patrick Mezard # Date 2010-10-09 20:13:08 # Node ID aa2fe1f52ff4090bac7a5a950d48e80e3106af8e # Parent 9ad16d1bce4bfb6a347ed4062bea9a12a963fbb4 patch: always raise PatchError with a message, simplify handling diff --git a/hgext/record.py b/hgext/record.py --- a/hgext/record.py +++ b/hgext/record.py @@ -499,11 +499,7 @@ def dorecord(ui, repo, commitfunc, *pats eolmode=None) cmdutil.updatedir(ui, repo, pfiles) except patch.PatchError, err: - s = str(err) - if s: - raise util.Abort(s) - else: - raise util.Abort(_('patch failed to apply')) + raise util.Abort(str(err)) del fp # 4. We prepared working directory according to filtered patch. diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -1233,7 +1233,7 @@ def internalpatch(patchobj, ui, strip, c if fp != patchobj: fp.close() if ret < 0: - raise PatchError + raise PatchError(_('patch failed to apply')) return ret > 0 def patch(patchname, ui, strip=1, cwd=None, files=None, eolmode='strict'): @@ -1256,11 +1256,7 @@ def patch(patchname, ui, strip=1, cwd=No return externalpatch(patcher, patchname, ui, strip, cwd, files) return internalpatch(patchname, ui, strip, cwd, files, eolmode) except PatchError, err: - s = str(err) - if s: - raise util.Abort(s) - else: - raise util.Abort(_('patch failed to apply')) + raise util.Abort(str(err)) def b85diff(to, tn): '''print base85-encoded binary diff'''