# HG changeset patch # User Dirkjan Ochtman # Date 2008-08-31 09:36:07 # Node ID 381a892159d994ed0c0e9bcef4962617d4e79ef9 # Parent 834f7e069caea2de8abc040da98bf0ba34f31c99 record: catch PatchErrors from internalpatch and display error message This resulted in big ugly tracebacks in issue1282, for example. diff --git a/hgext/record.py b/hgext/record.py --- a/hgext/record.py +++ b/hgext/record.py @@ -468,9 +468,16 @@ def dorecord(ui, repo, committer, *pats, # 3b. (apply) if dopatch: - ui.debug('applying patch\n') - ui.debug(fp.getvalue()) - patch.internalpatch(fp, ui, 1, repo.root) + try: + ui.debug('applying patch\n') + ui.debug(fp.getvalue()) + patch.internalpatch(fp, ui, 1, repo.root) + except patch.PatchError, err: + s = str(err) + if s: + raise util.Abort(s) + else: + raise util.Abort(_('patch failed to apply')) del fp # 4. We prepared working directory according to filtered patch.