Mercurial > hg
view tests/test-ui-verbosity.py @ 28488:437c32dcec7d
context: use changelogrevision
Upcoming patches will make the changelogrevision object perform
lazy parsing. Let's switch to it.
Because we're switching from a tuple to an object, everthing that
accesses the internal cached attribute needs to be updated to access
via attributes. A nice side-effect is this makes the code easier to
read!
Surprisingly, this appears to make revsets accessing this data
slightly faster (values are before series, p1, this patch):
author(mpm)
0.896565
0.929984
0.914234
desc(bug)
0.887169
0.935642
0.921073
date(2015)
0.878797
0.908094
0.891980
extra(rebase_source)
0.865446
0.922624
0.912514
author(mpm) or author(greg)
1.801832
1.902112
1.860402
author(mpm) or desc(bug)
1.812438
1.860977
1.844850
date(2015) or branch(default)
0.968276
1.005824
0.994673
author(mpm) or desc(bug) or date(2015) or extra(rebase_source)
3.656193
3.743381
3.721032
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 06 Mar 2016 13:26:37 -0800 |
parents | 4c50552fc9bc |
children | 870dae78234c |
line wrap: on
line source
import os from mercurial import ui hgrc = os.environ['HGRCPATH'] f = open(hgrc) basehgrc = f.read() f.close() print ' hgrc settings command line options final result ' print ' quiet verbo debug quiet verbo debug quiet verbo debug' for i in xrange(64): hgrc_quiet = bool(i & 1<<0) hgrc_verbose = bool(i & 1<<1) hgrc_debug = bool(i & 1<<2) cmd_quiet = bool(i & 1<<3) cmd_verbose = bool(i & 1<<4) cmd_debug = bool(i & 1<<5) f = open(hgrc, 'w') f.write(basehgrc) f.write('\n[ui]\n') if hgrc_quiet: f.write('quiet = True\n') if hgrc_verbose: f.write('verbose = True\n') if hgrc_debug: f.write('debug = True\n') f.close() u = ui.ui() if cmd_quiet or cmd_debug or cmd_verbose: u.setconfig('ui', 'quiet', str(bool(cmd_quiet))) u.setconfig('ui', 'verbose', str(bool(cmd_verbose))) u.setconfig('ui', 'debug', str(bool(cmd_debug))) check = '' if u.debugflag: if not u.verbose or u.quiet: check = ' *' elif u.verbose and u.quiet: check = ' +' print ('%2d %5s %5s %5s %5s %5s %5s -> %5s %5s %5s%s' % (i, hgrc_quiet, hgrc_verbose, hgrc_debug, cmd_quiet, cmd_verbose, cmd_debug, u.quiet, u.verbose, u.debugflag, check))