Debian Codegraph @

hgext/graphlog.py

raw
1 # ASCII graph log extension for Mercurial
2 #
3 # Copyright 2007 Joel Rosdahl <[email protected]>
4 #
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
7
8 '''command to view revision graphs from a shell (DEPRECATED)
9
10 The functionality of this extension has been include in core Mercurial
11 since version 2.3. Please use :hg:`log -G ...` instead.
12
13 This extension adds a --graph option to the incoming, outgoing and log
14 commands. When this options is given, an ASCII representation of the
15 revision graph is also shown.
16 '''
17
18 from __future__ import annotations
19
20 from mercurial.i18n import _
21 from mercurial import (
22 cmdutil,
23 commands,
24 registrar,
25 )
26
27 cmdtable = {}
28 command = registrar.command(cmdtable)
29 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
30 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
31 # be specifying the version(s) of Mercurial they are tested with, or
32 # leave the attribute unspecified.
33 testedwith = b'ships-with-hg-core'
34
35
36 @command(
37 b'glog',
38 [
39 (
40 b'f',
41 b'follow',
42 None,
43 _(
44 b'follow changeset history, or file history across copies and renames'
45 ),
46 ),
47 (
48 b'',
49 b'follow-first',
50 None,
51 _(b'only follow the first parent of merge changesets (DEPRECATED)'),
52 ),
53 (
54 b'd',
55 b'date',
56 b'',
57 _(b'show revisions matching date spec'),
58 _(b'DATE'),
59 ),
60 (b'C', b'copies', None, _(b'show copied files')),
61 (
62 b'k',
63 b'keyword',
64 [],
65 _(b'do case-insensitive search for a given text'),
66 _(b'TEXT'),
67 ),
68 (
69 b'r',
70 b'rev',
71 [],
72 _(b'show the specified revision or revset'),
73 _(b'REV'),
74 ),
75 (
76 b'',
77 b'removed',
78 None,
79 _(b'include revisions where files were removed'),
80 ),
81 (b'm', b'only-merges', None, _(b'show only merges (DEPRECATED)')),
82 (b'u', b'user', [], _(b'revisions committed by user'), _(b'USER')),
83 (
84 b'',
85 b'only-branch',
86 [],
87 _(
88 b'show only changesets within the given named branch (DEPRECATED)'
89 ),
90 _(b'BRANCH'),
91 ),
92 (
93 b'b',
94 b'branch',
95 [],
96 _(b'show changesets within the given named branch'),
97 _(b'BRANCH'),
98 ),
99 (
100 b'P',
101 b'prune',
102 [],
103 _(b'do not display revision or any of its ancestors'),
104 _(b'REV'),
105 ),
106 ]
107 + cmdutil.logopts
108 + cmdutil.walkopts,
109 _(b'[OPTION]... [FILE]'),
110 helpcategory=command.CATEGORY_CHANGE_NAVIGATION,
111 inferrepo=True,
112 )
113 def glog(ui, repo, *pats, **opts):
114 """show revision history alongside an ASCII revision graph
115
116 Print a revision history alongside a revision graph drawn with
117 ASCII characters.
118
119 Nodes printed as an @ character are parents of the working
120 directory.
121
122 This is an alias to :hg:`log -G`.
123 """
124 opts['graph'] = True
125 return commands.log(ui, repo, *pats, **opts)