changeset 30148:04f2b980df3c

perf: omit copying from ui.ferr to ui.fout for Mercurial earlier than 1.9 Before this patch, referring ui.ferr prevents perf.py from measuring performance with Mercurial earlier than 1.9 (or 4e1ccd4c2b6d), because ui.ferr isn't available in such Mercurial, even though there are some code paths for Mercurial earlier than 1.9 in perf.py. For example, setting "_prereadsize" attribute in perfindex() and perfnodelookup() is effective only with hg earlier than 1.8 (or 61c9bc3da402).
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sun, 09 Oct 2016 01:03:19 +0900
parents 423bf74d2e5b
children d8a2c536dd96
files contrib/perf.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf.py	Sun Oct 09 01:03:18 2016 +0900
+++ b/contrib/perf.py	Sun Oct 09 01:03:19 2016 +0900
@@ -137,7 +137,11 @@
         opts = {}
     # redirect all to stderr
     ui = ui.copy()
-    ui.fout = ui.ferr
+    uifout = safeattrsetter(ui, 'fout', ignoremissing=True)
+    if uifout:
+        # for "historical portability":
+        # ui.fout/ferr have been available since 1.9 (or 4e1ccd4c2b6d)
+        uifout.set(ui.ferr)
 
     # get a formatter
     uiformatter = getattr(ui, 'formatter', None)