# HG changeset patch # User Philippe Pepiot # Date 1479222657 -3600 # Node ID e77e8876886fd95d1ca28000356f999b82a1b95b # Parent a1beadaa406116c0266c46064a00003be7de7394 perf: omit copying ui and redirect to ferr if buffer API is in use This allow to get the output of contrib/perf.py commands using the ui.pushbuffer() API. diff -r a1beadaa4061 -r e77e8876886f contrib/perf.py --- a/contrib/perf.py Mon Nov 14 15:24:07 2016 -0800 +++ b/contrib/perf.py Tue Nov 15 16:10:57 2016 +0100 @@ -136,13 +136,14 @@ if opts is None: opts = {} - # redirect all to stderr - ui = ui.copy() - 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) + # redirect all to stderr unless buffer api is in use + if not ui._buffers: + ui = ui.copy() + 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)