Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

hgqt: enable traceback

At this time, we don't have the window to show tranceback text,
so it will be shown in console.

Changeset e467526daa6a

Parent adab918a8b6f

by Yuki KODAMA

Changes to 2 files · Browse files at e467526daa6a Showing diff from parent adab918a8b6f Diff from another changeset...

Change 1 of 2 Show Entire File thg Stacked
 
22
23
24
 
 
 
 
25
26
27
 
30
31
32
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
23
24
25
26
27
28
29
30
31
 
34
35
36
 
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
@@ -22,6 +22,10 @@
  if os.path.isdir(testpath) and hgpath not in sys.path:   sys.path.insert(0, hgpath)   +from mercurial import ui, util +import cStringIO +import traceback +  try:   import tortoisehg.hgqt.run  except ImportError: @@ -30,4 +34,29 @@
  sys.stderr.write("(check your install and PYTHONPATH)\n")   sys.exit(-1)   -sys.exit(tortoisehg.hgqt.run.dispatch(sys.argv[1:])) +_ui = ui.ui() +capt = _ui.configbool('tortoisehg', 'stderrcapt', True) + +if not capt or 'THGDEBUG' in os.environ or '--profile' in sys.argv: + sys.exit(tortoisehg.hgqt.run.dispatch(sys.argv[1:])) +else: + mystderr = cStringIO.StringIO() + origstderr = sys.stderr + sys.stderr = mystderr + ret = 0 + try: + ret = tortoisehg.hgqt.run.dispatch(sys.argv[1:]) + sys.stderr = origstderr + mystderr.seek(0) + for l in mystderr.readlines(): + if l.startswith('Traceback') or l.startswith('TypeError') or \ + l.startswith('NameError'): + print error + break + sys.exit(ret) + except: + if sys.exc_info()[0] not in [SystemExit, KeyboardInterrupt]: + sys.stderr = origstderr + traceback.print_exc() + else: + raise SystemExit(ret)
 
54
55
56
57
 
58
59
60
 
54
55
56
 
57
58
59
60
@@ -54,7 +54,7 @@
  except KeyboardInterrupt:   print _('\nCaught keyboard interrupt, aborting.\n')   except: - pass + print traceback.format_exc()    origwdir = os.getcwd()  def portable_fork(ui, opts):