Mercurial > hg
comparison hgext/graphlog.py @ 17181:6f71167292f2
log: support --graph without graphlog extension
The glog command is preserved in the extension for backward compatibility.
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Sat, 14 Jul 2012 19:09:22 +0200 |
parents | ae0629161090 |
children | cdf1532d89c6 |
comparison
equal
deleted
inserted
replaced
17180:ae0629161090 | 17181:6f71167292f2 |
---|---|
12 revision graph is also shown. | 12 revision graph is also shown. |
13 ''' | 13 ''' |
14 | 14 |
15 from mercurial.cmdutil import show_changeset | 15 from mercurial.cmdutil import show_changeset |
16 from mercurial.i18n import _ | 16 from mercurial.i18n import _ |
17 from mercurial import cmdutil, commands, extensions, scmutil | 17 from mercurial import cmdutil, commands, extensions |
18 from mercurial import hg, util, graphmod, templatekw | 18 from mercurial import hg, util, graphmod |
19 | 19 |
20 cmdtable = {} | 20 cmdtable = {} |
21 command = cmdutil.command(cmdtable) | 21 command = cmdutil.command(cmdtable) |
22 testedwith = 'internal' | 22 testedwith = 'internal' |
23 | 23 |
57 ASCII characters. | 57 ASCII characters. |
58 | 58 |
59 Nodes printed as an @ character are parents of the working | 59 Nodes printed as an @ character are parents of the working |
60 directory. | 60 directory. |
61 """ | 61 """ |
62 | 62 return cmdutil.graphlog(ui, repo, *pats, **opts) |
63 revs, expr, filematcher = cmdutil.getgraphlogrevs(repo, pats, opts) | |
64 revs = sorted(revs, reverse=1) | |
65 limit = cmdutil.loglimit(opts) | |
66 if limit is not None: | |
67 revs = revs[:limit] | |
68 revdag = graphmod.dagwalker(repo, revs) | |
69 | |
70 getrenamed = None | |
71 if opts.get('copies'): | |
72 endrev = None | |
73 if opts.get('rev'): | |
74 endrev = max(scmutil.revrange(repo, opts.get('rev'))) + 1 | |
75 getrenamed = templatekw.getrenamedfn(repo, endrev=endrev) | |
76 displayer = show_changeset(ui, repo, opts, buffered=True) | |
77 showparents = [ctx.node() for ctx in repo[None].parents()] | |
78 cmdutil.displaygraph(ui, revdag, displayer, showparents, | |
79 graphmod.asciiedges, getrenamed, filematcher) | |
80 | 63 |
81 def graphrevs(repo, nodes, opts): | 64 def graphrevs(repo, nodes, opts): |
82 limit = cmdutil.loglimit(opts) | 65 limit = cmdutil.loglimit(opts) |
83 nodes.reverse() | 66 nodes.reverse() |
84 if limit is not None: | 67 if limit is not None: |
127 | 110 |
128 hg._incoming(display, subreporecurse, ui, repo, source, opts, buffered=True) | 111 hg._incoming(display, subreporecurse, ui, repo, source, opts, buffered=True) |
129 | 112 |
130 def uisetup(ui): | 113 def uisetup(ui): |
131 '''Initialize the extension.''' | 114 '''Initialize the extension.''' |
132 _wrapcmd('log', commands.table, graphlog) | |
133 _wrapcmd('incoming', commands.table, gincoming) | 115 _wrapcmd('incoming', commands.table, gincoming) |
134 _wrapcmd('outgoing', commands.table, goutgoing) | 116 _wrapcmd('outgoing', commands.table, goutgoing) |
135 | 117 |
136 def _wrapcmd(cmd, table, wrapfn): | 118 def _wrapcmd(cmd, table, wrapfn): |
137 '''wrap the command''' | 119 '''wrap the command''' |