[PATCH] revsetbenchmark: handle exception case

Durham Goode durham at fb.com
Wed Feb 10 23:22:44 UTC 2016


# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1455136765 28800
#      Wed Feb 10 12:39:25 2016 -0800
# Node ID c791244507faabf86b1fd71746ec5b3d0364ed7d
# Parent  a036e1ae1fbe88ab99cb861ebfc2e4da7a3912ca
revsetbenchmark: handle exception case

If the revset being benchmarked has an exception, the handling code was
encountering an error because the exception did not always have an "output"
attribute (I think it's a python 2.7 thing).

diff --git a/contrib/revsetbenchmarks.py b/contrib/revsetbenchmarks.py
--- a/contrib/revsetbenchmarks.py
+++ b/contrib/revsetbenchmarks.py
@@ -63,7 +63,7 @@ def perf(revset, target=None, contexts=F
         return parseoutput(output)
     except CalledProcessError as exc:
         print >> sys.stderr, 'abort: cannot run revset benchmark: %s' % exc.cmd
-        if exc.output is None:
+        if getattr(exc, 'output', None) is None:
             print >> sys.stderr, '(no output)'
         else:
             print >> sys.stderr, exc.output


More information about the Mercurial-devel mailing list