diff --git a/hgext3rd/tweakdefaults.py b/hgext3rd/tweakdefaults.py --- a/hgext3rd/tweakdefaults.py +++ b/hgext3rd/tweakdefaults.py @@ -700,7 +700,9 @@ """Wraps analyzer to detect the use of colons in the revisions""" result = orig(x) - enabled = ui.configbool('tweakdefaults', 'singlecolonwarn') + warn = ui.configbool('tweakdefaults', 'singlecolonwarn') + abort = ui.configbool('tweakdefaults', 'singlecolonabort') + enabled = warn or abort # The last condition is added so that warnings are not shown if # hg log --follow is invoked w/o arguments @@ -708,8 +710,11 @@ (x[0] in ('range', 'rangepre', 'rangepost')) and \ x != ('rangepre', ('symbol', '.')): msg = ui.config('tweakdefaults', 'singlecolonmsg', - _("warning: use of ':' is deprecated")) - ui.warn('%s\n' % msg) + _("use of ':' is deprecated")) + if abort: + raise error.Abort('%s' % msg) + if warn: + ui.warn(_('warning: %s\n') % msg) return result diff --git a/tests/test-tweakdefaults-revsets.t b/tests/test-tweakdefaults-revsets.t --- a/tests/test-tweakdefaults-revsets.t +++ b/tests/test-tweakdefaults-revsets.t @@ -40,5 +40,13 @@ Check that the custom message can be used $ hg log -T '{rev} ' -r '0:' --config tweakdefaults.singlecolonwarn=1 --config tweakdefaults.singlecolonmsg="hey stop that" - hey stop that + warning: hey stop that 0 1 2 (no-eol) + +Check that we can abort as well + $ hg log -T '{rev} ' -r '0:' --config tweakdefaults.singlecolonabort=1 + abort: use of ':' is deprecated + [255] + $ hg log -T '{rev} ' -r '0:' --config tweakdefaults.singlecolonabort=1 --config tweakdefaults.singlecolonmsg="no more colons" + abort: no more colons + [255]