13 import patch, help, url, encoding, templatekw, discovery |
13 import patch, help, url, encoding, templatekw, discovery |
14 import archival, changegroup, cmdutil, hbisect |
14 import archival, changegroup, cmdutil, hbisect |
15 import sshserver, hgweb, hgweb.server, commandserver |
15 import sshserver, hgweb, hgweb.server, commandserver |
16 import merge as mergemod |
16 import merge as mergemod |
17 import minirst, revset, fileset |
17 import minirst, revset, fileset |
18 import dagparser, context, simplemerge |
18 import dagparser, context, simplemerge, graphmod |
19 import random, setdiscovery, treediscovery, dagutil, pvec |
19 import random, setdiscovery, treediscovery, dagutil, pvec |
20 import phases, obsolete |
20 import phases, obsolete |
21 |
21 |
22 table = {} |
22 table = {} |
23 |
23 |
96 ('g', 'git', None, _('use git extended diff format')), |
96 ('g', 'git', None, _('use git extended diff format')), |
97 ('l', 'limit', '', |
97 ('l', 'limit', '', |
98 _('limit number of changes displayed'), _('NUM')), |
98 _('limit number of changes displayed'), _('NUM')), |
99 ('M', 'no-merges', None, _('do not show merges')), |
99 ('M', 'no-merges', None, _('do not show merges')), |
100 ('', 'stat', None, _('output diffstat-style summary of changes')), |
100 ('', 'stat', None, _('output diffstat-style summary of changes')), |
|
101 ('G', 'graph', None, _("show the revision DAG")), |
101 ] + templateopts |
102 ] + templateopts |
102 |
103 |
103 diffopts = [ |
104 diffopts = [ |
104 ('a', 'text', None, _('treat all files as text')), |
105 ('a', 'text', None, _('treat all files as text')), |
105 ('g', 'git', None, _('use git extended diff format')), |
106 ('g', 'git', None, _('use git extended diff format')), |
3826 |
3827 |
3827 See pull for valid source format details. |
3828 See pull for valid source format details. |
3828 |
3829 |
3829 Returns 0 if there are incoming changes, 1 otherwise. |
3830 Returns 0 if there are incoming changes, 1 otherwise. |
3830 """ |
3831 """ |
|
3832 if opts.get('graph'): |
|
3833 cmdutil.checkunsupportedgraphflags([], opts) |
|
3834 def display(other, chlist, displayer): |
|
3835 revdag = cmdutil.graphrevs(other, chlist, opts) |
|
3836 showparents = [ctx.node() for ctx in repo[None].parents()] |
|
3837 cmdutil.displaygraph(ui, revdag, displayer, showparents, |
|
3838 graphmod.asciiedges) |
|
3839 |
|
3840 hg._incoming(display, lambda: 1, ui, repo, source, opts, buffered=True) |
|
3841 return 0 |
|
3842 |
3831 if opts.get('bundle') and opts.get('subrepos'): |
3843 if opts.get('bundle') and opts.get('subrepos'): |
3832 raise util.Abort(_('cannot combine --bundle and --subrepos')) |
3844 raise util.Abort(_('cannot combine --bundle and --subrepos')) |
3833 |
3845 |
3834 if opts.get('bookmarks'): |
3846 if opts.get('bookmarks'): |
3835 source, branches = hg.parseurl(ui.expandpath(source), |
3847 source, branches = hg.parseurl(ui.expandpath(source), |
3926 ('b', 'branch', [], |
3938 ('b', 'branch', [], |
3927 _('show changesets within the given named branch'), _('BRANCH')), |
3939 _('show changesets within the given named branch'), _('BRANCH')), |
3928 ('P', 'prune', [], |
3940 ('P', 'prune', [], |
3929 _('do not display revision or any of its ancestors'), _('REV')), |
3941 _('do not display revision or any of its ancestors'), _('REV')), |
3930 ('', 'hidden', False, _('show hidden changesets (DEPRECATED)')), |
3942 ('', 'hidden', False, _('show hidden changesets (DEPRECATED)')), |
3931 ('G', 'graph', None, _("show the revision DAG")), |
|
3932 ] + logopts + walkopts, |
3943 ] + logopts + walkopts, |
3933 _('[OPTION]... [FILE]')) |
3944 _('[OPTION]... [FILE]')) |
3934 def log(ui, repo, *pats, **opts): |
3945 def log(ui, repo, *pats, **opts): |
3935 """show revision history of entire repository or files |
3946 """show revision history of entire repository or files |
3936 |
3947 |
4281 |
4292 |
4282 See pull for details of valid destination formats. |
4293 See pull for details of valid destination formats. |
4283 |
4294 |
4284 Returns 0 if there are outgoing changes, 1 otherwise. |
4295 Returns 0 if there are outgoing changes, 1 otherwise. |
4285 """ |
4296 """ |
|
4297 if opts.get('graph'): |
|
4298 cmdutil.checkunsupportedgraphflags([], opts) |
|
4299 o = hg._outgoing(ui, repo, dest, opts) |
|
4300 if o is None: |
|
4301 return |
|
4302 |
|
4303 revdag = cmdutil.graphrevs(repo, o, opts) |
|
4304 displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True) |
|
4305 showparents = [ctx.node() for ctx in repo[None].parents()] |
|
4306 cmdutil.displaygraph(ui, revdag, displayer, showparents, |
|
4307 graphmod.asciiedges) |
|
4308 return 0 |
4286 |
4309 |
4287 if opts.get('bookmarks'): |
4310 if opts.get('bookmarks'): |
4288 dest = ui.expandpath(dest or 'default-push', dest or 'default') |
4311 dest = ui.expandpath(dest or 'default-push', dest or 'default') |
4289 dest, branches = hg.parseurl(dest, opts.get('branch')) |
4312 dest, branches = hg.parseurl(dest, opts.get('branch')) |
4290 other = hg.peer(repo, opts, dest) |
4313 other = hg.peer(repo, opts, dest) |