Mercurial > hg
comparison tests/test-ui-verbosity.py @ 8449:807f3f5c60e9
tests: renamed Python tests to .py
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Sun, 17 May 2009 01:39:31 +0200 |
parents | tests/test-ui-verbosity@6b5522cb2ad2 |
children | 4c50552fc9bc |
comparison
equal
deleted
inserted
replaced
8448:0eb8c4df61bd | 8449:807f3f5c60e9 |
---|---|
1 #!/usr/bin/env python | |
2 | |
3 import os | |
4 from mercurial import ui | |
5 | |
6 hgrc = os.environ['HGRCPATH'] | |
7 f = open(hgrc) | |
8 basehgrc = f.read() | |
9 f.close() | |
10 | |
11 print ' hgrc settings command line options final result ' | |
12 print ' quiet verbo debug quiet verbo debug quiet verbo debug' | |
13 | |
14 for i in xrange(64): | |
15 hgrc_quiet = bool(i & 1<<0) | |
16 hgrc_verbose = bool(i & 1<<1) | |
17 hgrc_debug = bool(i & 1<<2) | |
18 cmd_quiet = bool(i & 1<<3) | |
19 cmd_verbose = bool(i & 1<<4) | |
20 cmd_debug = bool(i & 1<<5) | |
21 | |
22 f = open(hgrc, 'w') | |
23 f.write(basehgrc) | |
24 f.write('\n[ui]\n') | |
25 if hgrc_quiet: | |
26 f.write('quiet = True\n') | |
27 if hgrc_verbose: | |
28 f.write('verbose = True\n') | |
29 if hgrc_debug: | |
30 f.write('debug = True\n') | |
31 f.close() | |
32 | |
33 u = ui.ui() | |
34 if cmd_quiet or cmd_debug or cmd_verbose: | |
35 u.setconfig('ui', 'quiet', str(bool(cmd_quiet))) | |
36 u.setconfig('ui', 'verbose', str(bool(cmd_verbose))) | |
37 u.setconfig('ui', 'debug', str(bool(cmd_debug))) | |
38 | |
39 check = '' | |
40 if u.debugflag: | |
41 if not u.verbose or u.quiet: | |
42 check = ' *' | |
43 elif u.verbose and u.quiet: | |
44 check = ' +' | |
45 | |
46 print ('%2d %5s %5s %5s %5s %5s %5s -> %5s %5s %5s%s' | |
47 % (i, hgrc_quiet, hgrc_verbose, hgrc_debug, | |
48 cmd_quiet, cmd_verbose, cmd_debug, | |
49 u.quiet, u.verbose, u.debugflag, check)) |