tests/test-ui-verbosity.py
author Mads Kiilerich <mads@kiilerich.com>
Tue, 29 Jun 2010 12:12:34 +0200
branchstable
changeset 11488 f786fc4b8764
parent 8449 807f3f5c60e9
child 12865 4c50552fc9bc
permissions -rw-r--r--
log: follow filenames through renames (issue647) In commands.log a displayer was initialized from cmdutil.show_changeset() with the initial matchfn (which designates the specified files which only is correct in the highest revision in the range). prep() is handed the correct list of files, but displayer.show() didn't use that list but keept using the original matchfn. The matchfn argument to cmdutil.show_changeset() wasn't specified in other places and is only used in .show(), so now we give the matchfn as an optional parameter to .show(). We do however still have to detect --patch and --stat from opts in show_changeset() and let it imply a matchall, but that can now be overruled with the new .show() matchfn parameter.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3349
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     1
#!/usr/bin/env python
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     2
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     3
import os
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     4
from mercurial import ui
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     5
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     6
hgrc = os.environ['HGRCPATH']
5523
5db730475d6d tests/*: avoid losing the original settings from $HGRCPATH
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3349
diff changeset
     7
f = open(hgrc)
5db730475d6d tests/*: avoid losing the original settings from $HGRCPATH
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3349
diff changeset
     8
basehgrc = f.read()
5db730475d6d tests/*: avoid losing the original settings from $HGRCPATH
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3349
diff changeset
     9
f.close()
3349
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    10
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    11
print '      hgrc settings    command line options      final result   '
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    12
print '    quiet verbo debug   quiet verbo debug      quiet verbo debug'
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    13
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    14
for i in xrange(64):
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    15
    hgrc_quiet   = bool(i & 1<<0)
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    16
    hgrc_verbose = bool(i & 1<<1)
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    17
    hgrc_debug   = bool(i & 1<<2)
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    18
    cmd_quiet    = bool(i & 1<<3)
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    19
    cmd_verbose  = bool(i & 1<<4)
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    20
    cmd_debug    = bool(i & 1<<5)
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    21
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    22
    f = open(hgrc, 'w')
5523
5db730475d6d tests/*: avoid losing the original settings from $HGRCPATH
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3349
diff changeset
    23
    f.write(basehgrc)
5db730475d6d tests/*: avoid losing the original settings from $HGRCPATH
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3349
diff changeset
    24
    f.write('\n[ui]\n')
3349
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    25
    if hgrc_quiet:
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    26
        f.write('quiet = True\n')
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    27
    if hgrc_verbose:
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    28
        f.write('verbose = True\n')
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    29
    if hgrc_debug:
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    30
        f.write('debug = True\n')
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    31
    f.close()
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    32
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    33
    u = ui.ui()
8136
6b5522cb2ad2 ui: refactor option setting
Matt Mackall <mpm@selenic.com>
parents: 5523
diff changeset
    34
    if cmd_quiet or cmd_debug or cmd_verbose:
6b5522cb2ad2 ui: refactor option setting
Matt Mackall <mpm@selenic.com>
parents: 5523
diff changeset
    35
        u.setconfig('ui', 'quiet', str(bool(cmd_quiet)))
6b5522cb2ad2 ui: refactor option setting
Matt Mackall <mpm@selenic.com>
parents: 5523
diff changeset
    36
        u.setconfig('ui', 'verbose', str(bool(cmd_verbose)))
6b5522cb2ad2 ui: refactor option setting
Matt Mackall <mpm@selenic.com>
parents: 5523
diff changeset
    37
        u.setconfig('ui', 'debug', str(bool(cmd_debug)))
3349
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    38
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    39
    check = ''
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    40
    if u.debugflag:
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    41
        if not u.verbose or u.quiet:
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    42
            check = ' *'
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    43
    elif u.verbose and u.quiet:
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    44
        check = ' +'
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    45
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    46
    print ('%2d  %5s %5s %5s   %5s %5s %5s  ->  %5s %5s %5s%s'
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    47
           % (i, hgrc_quiet, hgrc_verbose, hgrc_debug,
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    48
              cmd_quiet, cmd_verbose, cmd_debug,
25d270e0b27f ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    49
              u.quiet, u.verbose, u.debugflag, check))