# HG changeset patch # User Pierre-Yves David # Date 2015-09-11 19:45:19 # Node ID bf2bfc6f45fb2c7446ddcb26911c3588b9a43402 # Parent 3e79ec0ba589aafd07e29c3e8a920a7bb280861d traceback: allow providing a local support contact point The extensions blaming code is fine for casual users but pretty terrible for corporate environments that can deploy a large amount of extensions to unsuspecting users. Reports will likely blame a random "innocent" extension (in our case crecord) and the hint in the message will triggers endless debug attempts from the user. We introduce a "ui.supportcontact" option that allow such big company to redirect their users to their own support desk. This disables all extensions blaming and just point people to the local support in all cases. diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -335,7 +335,7 @@ def _runcatch(req): compare = myver.split('+')[0] ct = tuplever(compare) worst = None, ct, '' - if True: + if ui.config('ui', 'supportcontact', None) is None: for name, mod in extensions.extensions(): testedwith = getattr(mod, 'testedwith', '') report = getattr(mod, 'buglink', _('the extension author.')) @@ -367,9 +367,11 @@ def _runcatch(req): '** If that fixes the bug please report it to %s\n') % (name, testedwith, name, report)) else: + bugtracker = ui.config('ui', 'supportcontact', None) + if bugtracker is None: + bugtracker = _("http://mercurial.selenic.com/wiki/BugTracker") warning = (_("** unknown exception encountered, " - "please report by visiting\n") + - _("** http://mercurial.selenic.com/wiki/BugTracker\n")) + "please report by visiting\n** ") + bugtracker + '\n') warning += ((_("** Python %s\n") % sys.version.replace('\n', '')) + (_("** Mercurial Distributed SCM (version %s)\n") % myver) + (_("** Extensions loaded: %s\n") % diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt --- a/mercurial/help/config.txt +++ b/mercurial/help/config.txt @@ -1511,6 +1511,11 @@ User interface controls. ``style`` Name of style to use for command output. +``supportcontact`` + Location pointed at in Mercurial traceback for reporting crash. Use this if + you are a large organisation with it's own Mercurial deployement process and + crash reports should be addressed to your internal support. + ``timeout`` The timeout used when a lock is held (in seconds), a negative value means no timeout. (default: 600) diff --git a/tests/test-extension.t b/tests/test-extension.t --- a/tests/test-extension.t +++ b/tests/test-extension.t @@ -943,6 +943,15 @@ Older extension is tested with current v ** Mercurial Distributed SCM (version 1.9.3) ** Extensions loaded: throw, older +Ability to point to a different point + $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ + > --config ui.supportcontact='Your Local Goat Lenders' throw 2>&1 | egrep '^\*\*' + ** unknown exception encountered, please report by visiting + ** Your Local Goat Lenders + ** Python * (glob) + ** Mercurial Distributed SCM (*) (glob) + ** Extensions loaded: throw, older + Declare the version as supporting this hg version, show regular bts link: $ hgver=`$PYTHON -c 'from mercurial import util; print util.version().split("+")[0]'` $ echo 'testedwith = """'"$hgver"'"""' >> throw.py