[PATCH 3 of 3] chgserver: print traceback if --traceback flag is passed to validate

Yuya Nishihara yuya at tcha.org
Tue Mar 22 11:31:39 EDT 2016


On Mon, 21 Mar 2016 10:50:36 -0700, Sean Farley wrote:
> > 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?

It is a hack of the same weirdness as dispatch.dispatch(). There's a
chicken-and-egg issue that is the option parser needs a ui but creating a ui
can raise an exception.


More information about the Mercurial-devel mailing list