[PATCH 3 of 3] chgserver: print traceback if --traceback flag is passed to validate
Sean Farley
sean at farley.io
Mon Mar 21 13:50:36 EDT 2016
Yuya Nishihara <yuya at tcha.org> writes:
> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1458516023 25200
> # Sun Mar 20 16:20:23 2016 -0700
> # Node ID a63445cc0d56f1af9e29a1eb3afa75623330f709
> # Parent 306bcd1d5f7655ea1ab3f1bc87a48ce9d7a6c150
> chgserver: print traceback if --traceback flag is passed to validate
>
> This makes test-globalopts.t pass with chg. We cannot trust ui.tracebackflag
> at this point because we haven't run dispatch() with the new args yet and
> ui.tracebackflag may be set globally by "serve --cmdserver chgunix --traceback".
These patches look good to me but see below.
> diff --git a/hgext/chgserver.py b/hgext/chgserver.py
> --- a/hgext/chgserver.py
> +++ b/hgext/chgserver.py
> @@ -448,7 +448,14 @@ class chgcmdserver(commandserver.server)
> """
> args = self._readlist()
> try:
> - self.ui, lui = _loadnewui(self.ui, args)
> + try:
> + self.ui, lui = _loadnewui(self.ui, args)
> + except: # re-raises
> + # simulate early traceback output in dispatch.dispatch(),
> + # where args aren't fully parsed
> + if '--traceback' in args:
> + self.ui.traceback(force=True)
> + raise
This seems like a bit of a hack. Is there no better way to do it? Or is
it something that will be refactored later?
More information about the Mercurial-devel
mailing list