[PATCH 3 of 3] chgserver: print traceback if --traceback flag is passed to validate
Yuya Nishihara
yuya at tcha.org
Sun Mar 20 21:27:01 EDT 2016
# 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".
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
except error.ParseError as inst:
dispatch._formatparse(self.ui.warn, inst)
self.ui.flush()
More information about the Mercurial-devel
mailing list