hgext/graphlog.py
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Fri, 30 Nov 2012 00:43:55 +0900
branchstable
changeset 18006 0c10cf819146
parent 17773 434e5bd615fc
child 18267 5bb610f87d1d
permissions -rw-r--r--
subrepo: add argument to "diff()" to pass "ui" of caller side (issue3712) (API) Color extension achieves colorization by overriding the class of "ui" object just before command execution. Before this patch, "diff()" of abstractsubrepo and classes derived from it has no "ui" argument, so "diff()" of hgsubrepo uses "self._repo.ui" to invoke "cmdutil.diffordiffstat()". For separation of configuration between repositories, revision 573bec4ab7ba changed the initialization source of "self._repo.ui" from "ui"(overridden) to "baseui"(plain) of parent repository. And this caused break of colorization. This patch adds "ui" argument to "diff()" of abstractsubrepo and classes derived from it to pass "ui" object of caller side.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4344
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
     1
# ASCII graph log extension for Mercurial
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
     2
#
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
     3
# Copyright 2007 Joel Rosdahl <joel@rosdahl.net>
4516
96d8a56d4ef9 Removed trailing whitespace and tabs from python files
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4509
diff changeset
     4
#
8225
46293a0c7e9f updated license to be explicit about GPL version 2
Martin Geisler <mg@lazybytes.net>
parents: 8210
diff changeset
     5
# This software may be used and distributed according to the terms of the
10263
25e572394f5c Update license to GPLv2+
Matt Mackall <mpm@selenic.com>
parents: 10097
diff changeset
     6
# GNU General Public License version 2 or any later version.
8228
eee2319c5895 add blank line after copyright notices and after header
Martin Geisler <mg@lazybytes.net>
parents: 8225
diff changeset
     7
8934
9dda4c73fc3b extensions: change descriptions for extensions providing a few commands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8932
diff changeset
     8
'''command to view revision graphs from a shell
7426
df0962f6c54e Graphlog extension adds a --graph option to log/in/out
Alpar Juttner <alpar@cs.elte.hu>
parents: 7383
diff changeset
     9
df0962f6c54e Graphlog extension adds a --graph option to log/in/out
Alpar Juttner <alpar@cs.elte.hu>
parents: 7383
diff changeset
    10
This extension adds a --graph option to the incoming, outgoing and log
9259
19a4b8fd5c48 graphlog: wrap docstrings at 70 characters
Martin Geisler <mg@lazybytes.net>
parents: 9198
diff changeset
    11
commands. When this options is given, an ASCII representation of the
19a4b8fd5c48 graphlog: wrap docstrings at 70 characters
Martin Geisler <mg@lazybytes.net>
parents: 9198
diff changeset
    12
revision graph is also shown.
7426
df0962f6c54e Graphlog extension adds a --graph option to log/in/out
Alpar Juttner <alpar@cs.elte.hu>
parents: 7383
diff changeset
    13
'''
4344
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    14
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    15
from mercurial.i18n import _
17182
cdf1532d89c6 incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents: 17181
diff changeset
    16
from mercurial import cmdutil, commands
5938
9ed100559851 graphlog: add filelog revision grapher
Steve Borho <steve@borho.org>
parents: 4735
diff changeset
    17
14311
9bbac962f4dd graphlog: use cmdutil.command decorator
Adrian Buehlmann <adrian@cadifra.com>
parents: 14139
diff changeset
    18
cmdtable = {}
9bbac962f4dd graphlog: use cmdutil.command decorator
Adrian Buehlmann <adrian@cadifra.com>
parents: 14139
diff changeset
    19
command = cmdutil.command(cmdtable)
16743
38caf405d010 hgext: mark all first-party extensions as such
Augie Fackler <raf@durin42.com>
parents: 16434
diff changeset
    20
testedwith = 'internal'
14311
9bbac962f4dd graphlog: use cmdutil.command decorator
Adrian Buehlmann <adrian@cadifra.com>
parents: 14139
diff changeset
    21
9bbac962f4dd graphlog: use cmdutil.command decorator
Adrian Buehlmann <adrian@cadifra.com>
parents: 14139
diff changeset
    22
@command('glog',
16432
365bb0fa73a4 graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents: 16431
diff changeset
    23
    [('f', 'follow', None,
365bb0fa73a4 graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents: 16431
diff changeset
    24
     _('follow changeset history, or file history across copies and renames')),
365bb0fa73a4 graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents: 16431
diff changeset
    25
    ('', 'follow-first', None,
365bb0fa73a4 graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents: 16431
diff changeset
    26
     _('only follow the first parent of merge changesets (DEPRECATED)')),
365bb0fa73a4 graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents: 16431
diff changeset
    27
    ('d', 'date', '', _('show revisions matching date spec'), _('DATE')),
365bb0fa73a4 graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents: 16431
diff changeset
    28
    ('C', 'copies', None, _('show copied files')),
365bb0fa73a4 graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents: 16431
diff changeset
    29
    ('k', 'keyword', [],
365bb0fa73a4 graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents: 16431
diff changeset
    30
     _('do case-insensitive search for a given text'), _('TEXT')),
14311
9bbac962f4dd graphlog: use cmdutil.command decorator
Adrian Buehlmann <adrian@cadifra.com>
parents: 14139
diff changeset
    31
    ('r', 'rev', [], _('show the specified revision or range'), _('REV')),
16432
365bb0fa73a4 graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents: 16431
diff changeset
    32
    ('', 'removed', None, _('include revisions where files were removed')),
365bb0fa73a4 graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents: 16431
diff changeset
    33
    ('m', 'only-merges', None, _('show only merges (DEPRECATED)')),
365bb0fa73a4 graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents: 16431
diff changeset
    34
    ('u', 'user', [], _('revisions committed by user'), _('USER')),
365bb0fa73a4 graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents: 16431
diff changeset
    35
    ('', 'only-branch', [],
365bb0fa73a4 graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents: 16431
diff changeset
    36
     _('show only changesets within the given named branch (DEPRECATED)'),
365bb0fa73a4 graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents: 16431
diff changeset
    37
     _('BRANCH')),
365bb0fa73a4 graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents: 16431
diff changeset
    38
    ('b', 'branch', [],
365bb0fa73a4 graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents: 16431
diff changeset
    39
     _('show changesets within the given named branch'), _('BRANCH')),
365bb0fa73a4 graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents: 16431
diff changeset
    40
    ('P', 'prune', [],
365bb0fa73a4 graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents: 16431
diff changeset
    41
     _('do not display revision or any of its ancestors'), _('REV')),
365bb0fa73a4 graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents: 16431
diff changeset
    42
    ('', 'hidden', False, _('show hidden changesets (DEPRECATED)')),
365bb0fa73a4 graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents: 16431
diff changeset
    43
    ] + commands.logopts + commands.walkopts,
365bb0fa73a4 graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents: 16431
diff changeset
    44
    _('[OPTION]... [FILE]'))
14043
1c1e1232abdc graphlog: make use of graphmod's revset support
Alexander Solovyov <alexander@solovyov.net>
parents: 14042
diff changeset
    45
def graphlog(ui, repo, *pats, **opts):
7325
f9985108d4e4 graphlog: split the actual DAG grapher out into a separate method
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7324
diff changeset
    46
    """show revision history alongside an ASCII revision graph
f9985108d4e4 graphlog: split the actual DAG grapher out into a separate method
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7324
diff changeset
    47
9259
19a4b8fd5c48 graphlog: wrap docstrings at 70 characters
Martin Geisler <mg@lazybytes.net>
parents: 9198
diff changeset
    48
    Print a revision history alongside a revision graph drawn with
19a4b8fd5c48 graphlog: wrap docstrings at 70 characters
Martin Geisler <mg@lazybytes.net>
parents: 9198
diff changeset
    49
    ASCII characters.
7325
f9985108d4e4 graphlog: split the actual DAG grapher out into a separate method
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7324
diff changeset
    50
9259
19a4b8fd5c48 graphlog: wrap docstrings at 70 characters
Martin Geisler <mg@lazybytes.net>
parents: 9198
diff changeset
    51
    Nodes printed as an @ character are parents of the working
19a4b8fd5c48 graphlog: wrap docstrings at 70 characters
Martin Geisler <mg@lazybytes.net>
parents: 9198
diff changeset
    52
    directory.
7325
f9985108d4e4 graphlog: split the actual DAG grapher out into a separate method
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7324
diff changeset
    53
    """
17181
6f71167292f2 log: support --graph without graphlog extension
Patrick Mezard <patrick@mezard.eu>
parents: 17180
diff changeset
    54
    return cmdutil.graphlog(ui, repo, *pats, **opts)
17773
434e5bd615fc commands: don't infer repo for commands like update (issue2748)
Siddharth Agarwal <sid0@fb.com>
parents: 17182
diff changeset
    55
434e5bd615fc commands: don't infer repo for commands like update (issue2748)
Siddharth Agarwal <sid0@fb.com>
parents: 17182
diff changeset
    56
commands.inferrepo += " glog"