diff --git a/hgext3rd/tweakdefaults.py b/hgext3rd/tweakdefaults.py --- a/hgext3rd/tweakdefaults.py +++ b/hgext3rd/tweakdefaults.py @@ -40,6 +40,9 @@ # change rebase exit from 1 to 0 if nothing is rebased nooprebase = True + # whether to show a warning on some deprecated usages + singlecolonwarn = False + # educational messages bmnodesthint = '' bmnodestmsg = '' @@ -49,6 +52,7 @@ nodesthint = '' nodestmsg = '' rollbackhint = '' + singlecolonmsg = '' tagsmessage = '' # output new hashes when nodes get updated @@ -695,16 +699,19 @@ return cmd def _analyzewrapper(orig, x, ui): - """Wraps analyzer to detect the use of colons in the revisions - """ + """Wraps analyzer to detect the use of colons in the revisions""" result = orig(x) - if isinstance(x, tuple) and \ + enabled = ui.configbool('tweakdefaults', 'singlecolonwarn') + + # The last condition is added so that warnings are not shown if + # hg log --follow is invoked w/o arguments + if enabled and isinstance(x, tuple) and \ (x[0] in ('range', 'rangepre', 'rangepost')) and \ x != ('rangepre', ('symbol', '.')): - # The last condition is added so that warnings are not shown if - # hg log --follow is invoked w/o arguments - ui.develwarn("use of ':' is deprecated\n") + msg = ui.config('tweakdefaults', 'singlecolonmsg', + _("use of ':' is deprecated")) + ui.warn('%s\n' % msg) return result diff --git a/tests/test-tweakdefaults.t b/tests/test-tweakdefaults.t --- a/tests/test-tweakdefaults.t +++ b/tests/test-tweakdefaults.t @@ -1,4 +1,4 @@ -#testcases develwarn.true develwarn.false +#testcases singlecolonwarn.true singlecolonwarn.false $ . "$TESTDIR/histedit-helpers.sh" $ cat >> $HGRCPATH << EOF @@ -11,10 +11,10 @@ > updatecheck=noconflict > EOF -#if develwarn.false +#if singlecolonwarn.true $ cat >> $HGRCPATH << EOF > [tweakdefaults] - > develwarn = False + > singlecolonwarn = True > EOF #endif @@ -754,10 +754,9 @@ Test that developer warning is shown whenever ':' is used implicitly or explicitly -#if develwarn.true +#if singlecolonwarn.true $ hg log -G -T '{rev} {bookmarks}' -r '0:2' - devel-warn: use of ':' is deprecated - at: *tweakdefaults.py:* (_analyzewrap) (glob) + use of ':' is deprecated o 2 | o 1 master @@ -774,10 +773,9 @@ #endif -#if develwarn.true +#if singlecolonwarn.true $ hg log -G -T '{rev} {bookmarks}' -r ':2' - devel-warn: use of ':' is deprecated - at: *tweakdefaults.py:* (_analyzewrap) (glob) + use of ':' is deprecated o 2 | o 1 master @@ -794,10 +792,9 @@ #endif -#if develwarn.true +#if singlecolonwarn.true $ hg log -G -T '{rev} {bookmarks}' -r '0:' - devel-warn: use of ':' is deprecated - at: *tweakdefaults.py:* (_analyzewrap) (glob) + use of ':' is deprecated o 2 | o 1 master