##// END OF EJS Templates
log: support --graph without graphlog extension...
log: support --graph without graphlog extension The glog command is preserved in the extension for backward compatibility.

File last commit:

r17181:6f711672 default
r17181:6f711672 default
Show More
graphlog.py
125 lines | 4.4 KiB | text/x-python | PythonLexer
Joel Rosdahl
Add graphlog extension
r4344 # ASCII graph log extension for Mercurial
#
# Copyright 2007 Joel Rosdahl <joel@rosdahl.net>
Thomas Arendsen Hein
Removed trailing whitespace and tabs from python files
r4516 #
Martin Geisler
updated license to be explicit about GPL version 2
r8225 # This software may be used and distributed according to the terms of the
Matt Mackall
Update license to GPLv2+
r10263 # GNU General Public License version 2 or any later version.
Martin Geisler
add blank line after copyright notices and after header
r8228
Dirkjan Ochtman
extensions: change descriptions for extensions providing a few commands
r8934 '''command to view revision graphs from a shell
Alpar Juttner
Graphlog extension adds a --graph option to log/in/out...
r7426
This extension adds a --graph option to the incoming, outgoing and log
Martin Geisler
graphlog: wrap docstrings at 70 characters
r9259 commands. When this options is given, an ASCII representation of the
revision graph is also shown.
Alpar Juttner
Graphlog extension adds a --graph option to log/in/out...
r7426 '''
Joel Rosdahl
Add graphlog extension
r4344
Matt Mackall
scmutil: move revsingle/pair/range from cmdutil...
r14319 from mercurial.cmdutil import show_changeset
Joel Rosdahl
Add graphlog extension
r4344 from mercurial.i18n import _
Patrick Mezard
log: support --graph without graphlog extension...
r17181 from mercurial import cmdutil, commands, extensions
from mercurial import hg, util, graphmod
Steve Borho
graphlog: add filelog revision grapher...
r5938
Adrian Buehlmann
graphlog: use cmdutil.command decorator
r14311 cmdtable = {}
command = cmdutil.command(cmdtable)
Augie Fackler
hgext: mark all first-party extensions as such
r16743 testedwith = 'internal'
Adrian Buehlmann
graphlog: use cmdutil.command decorator
r14311
Patrick Mezard
graphlog: make functions private, fix names
r17163 def _checkunsupportedflags(pats, opts):
Patrick Mezard
graphlog: implement --copies
r16180 for op in ["newest_first"]:
Alpar Juttner
Graphlog extension adds a --graph option to log/in/out...
r7426 if op in opts and opts[op]:
Alexander Solovyov
graphlog: make use of graphmod's revset support
r14043 raise util.Abort(_("-G/--graph option is incompatible with --%s")
Greg Ward
glog: fix "incompatible option" error message....
r10097 % op.replace("_", "-"))
Alpar Juttner
Graphlog extension adds a --graph option to log/in/out...
r7426
Adrian Buehlmann
graphlog: use cmdutil.command decorator
r14311 @command('glog',
Patrick Mezard
graphlog: add all log options to glog command...
r16432 [('f', 'follow', None,
_('follow changeset history, or file history across copies and renames')),
('', 'follow-first', None,
_('only follow the first parent of merge changesets (DEPRECATED)')),
('d', 'date', '', _('show revisions matching date spec'), _('DATE')),
('C', 'copies', None, _('show copied files')),
('k', 'keyword', [],
_('do case-insensitive search for a given text'), _('TEXT')),
Adrian Buehlmann
graphlog: use cmdutil.command decorator
r14311 ('r', 'rev', [], _('show the specified revision or range'), _('REV')),
Patrick Mezard
graphlog: add all log options to glog command...
r16432 ('', 'removed', None, _('include revisions where files were removed')),
('m', 'only-merges', None, _('show only merges (DEPRECATED)')),
('u', 'user', [], _('revisions committed by user'), _('USER')),
('', 'only-branch', [],
_('show only changesets within the given named branch (DEPRECATED)'),
_('BRANCH')),
('b', 'branch', [],
_('show changesets within the given named branch'), _('BRANCH')),
('P', 'prune', [],
_('do not display revision or any of its ancestors'), _('REV')),
('', 'hidden', False, _('show hidden changesets (DEPRECATED)')),
] + commands.logopts + commands.walkopts,
_('[OPTION]... [FILE]'))
Alexander Solovyov
graphlog: make use of graphmod's revset support
r14043 def graphlog(ui, repo, *pats, **opts):
Peter Arrenbrecht
graphlog: split the actual DAG grapher out into a separate method...
r7325 """show revision history alongside an ASCII revision graph
Martin Geisler
graphlog: wrap docstrings at 70 characters
r9259 Print a revision history alongside a revision graph drawn with
ASCII characters.
Peter Arrenbrecht
graphlog: split the actual DAG grapher out into a separate method...
r7325
Martin Geisler
graphlog: wrap docstrings at 70 characters
r9259 Nodes printed as an @ character are parents of the working
directory.
Peter Arrenbrecht
graphlog: split the actual DAG grapher out into a separate method...
r7325 """
Patrick Mezard
log: support --graph without graphlog extension...
r17181 return cmdutil.graphlog(ui, repo, *pats, **opts)
Dirkjan Ochtman
graphlog: extract large parts of repeated code from incoming/outgoing
r7716
def graphrevs(repo, nodes, opts):
limit = cmdutil.loglimit(opts)
Peter Arrenbrecht
graphmod/graphlog: extract nodelistwalk
r8837 nodes.reverse()
Nicolas Dumazet
cmdutil: replace sys.maxint with None as default value in loglimit...
r10111 if limit is not None:
Peter Arrenbrecht
graphmod/graphlog: extract nodelistwalk
r8837 nodes = nodes[:limit]
return graphmod.nodes(repo, nodes)
Dirkjan Ochtman
graphlog: extract large parts of repeated code from incoming/outgoing
r7716
def goutgoing(ui, repo, dest=None, **opts):
"""show the outgoing changesets alongside an ASCII revision graph
Peter Arrenbrecht
graphlog: split the actual DAG grapher out into a separate method...
r7325
Dirkjan Ochtman
graphlog: extract large parts of repeated code from incoming/outgoing
r7716 Print the outgoing changesets alongside a revision graph drawn with
ASCII characters.
Alpar Juttner
Graphlog extension adds a --graph option to log/in/out...
r7426
Dirkjan Ochtman
graphlog: extract large parts of repeated code from incoming/outgoing
r7716 Nodes printed as an @ character are parents of the working
directory.
Alpar Juttner
Graphlog extension adds a --graph option to log/in/out...
r7426 """
Dirkjan Ochtman
graphlog: extract large parts of repeated code from incoming/outgoing
r7716
Patrick Mezard
graphlog: make functions private, fix names
r17163 _checkunsupportedflags([], opts)
Nicolas Dumazet
outgoing: unify common graphlog.outgoing and hg.outgoing code
r12735 o = hg._outgoing(ui, repo, dest, opts)
if o is None:
Alpar Juttner
Graphlog extension adds a --graph option to log/in/out...
r7426 return
Dirkjan Ochtman
graphlog: extract large parts of repeated code from incoming/outgoing
r7716
revdag = graphrevs(repo, o, opts)
Dirkjan Ochtman
graphlog: extract some setup code out of common functions
r9368 displayer = show_changeset(ui, repo, opts, buffered=True)
showparents = [ctx.node() for ctx in repo[None].parents()]
Patrick Mezard
graphlog: extract revset/support functions into cmdutil
r17180 cmdutil.displaygraph(ui, revdag, displayer, showparents,
graphmod.asciiedges)
Alpar Juttner
Graphlog extension adds a --graph option to log/in/out...
r7426
def gincoming(ui, repo, source="default", **opts):
"""show the incoming changesets alongside an ASCII revision graph
Martin Geisler
graphlog: wrap docstrings at 70 characters
r9259 Print the incoming changesets alongside a revision graph drawn with
ASCII characters.
Alpar Juttner
Graphlog extension adds a --graph option to log/in/out...
r7426
Martin Geisler
graphlog: wrap docstrings at 70 characters
r9259 Nodes printed as an @ character are parents of the working
directory.
Alpar Juttner
Graphlog extension adds a --graph option to log/in/out...
r7426 """
Nicolas Dumazet
incoming: unify code for incoming and graphlog.incoming
r12730 def subreporecurse():
return 1
Alpar Juttner
Graphlog extension adds a --graph option to log/in/out...
r7426
Patrick Mezard
graphlog: make functions private, fix names
r17163 _checkunsupportedflags([], opts)
Nicolas Dumazet
incoming: unify code for incoming and graphlog.incoming
r12730 def display(other, chlist, displayer):
Dirkjan Ochtman
graphlog: extract large parts of repeated code from incoming/outgoing
r7716 revdag = graphrevs(other, chlist, opts)
Dirkjan Ochtman
graphlog: extract some setup code out of common functions
r9368 showparents = [ctx.node() for ctx in repo[None].parents()]
Patrick Mezard
graphlog: extract revset/support functions into cmdutil
r17180 cmdutil.displaygraph(ui, revdag, displayer, showparents,
graphmod.asciiedges)
Alpar Juttner
Graphlog extension adds a --graph option to log/in/out...
r7426
Nicolas Dumazet
incoming: unify code for incoming and graphlog.incoming
r12730 hg._incoming(display, subreporecurse, ui, repo, source, opts, buffered=True)
Alpar Juttner
Graphlog extension adds a --graph option to log/in/out...
r7426
def uisetup(ui):
'''Initialize the extension.'''
Idan Kamara
graphlog: remove unused arg from _wrapcmd
r14416 _wrapcmd('incoming', commands.table, gincoming)
_wrapcmd('outgoing', commands.table, goutgoing)
Alpar Juttner
Graphlog extension adds a --graph option to log/in/out...
r7426
Idan Kamara
graphlog: remove unused arg from _wrapcmd
r14416 def _wrapcmd(cmd, table, wrapfn):
Alpar Juttner
Graphlog extension adds a --graph option to log/in/out...
r7426 '''wrap the command'''
def graph(orig, *args, **kwargs):
if kwargs['graph']:
Alexander Solovyov
graphlog: make use of graphmod's revset support
r14043 return wrapfn(*args, **kwargs)
Alpar Juttner
Graphlog extension adds a --graph option to log/in/out...
r7426 return orig(*args, **kwargs)
entry = extensions.wrapcommand(table, cmd, graph)
Jim Correia
log-like commands now use -G for --graph, -g for --git
r7763 entry[1].append(('G', 'graph', None, _("show the revision DAG")))