##// END OF EJS Templates
children: use hg reST role for example
Martin Geisler -
r16670:05204775 default
parent child Browse files
Show More
@@ -1,49 +1,49 b''
1 # Mercurial extension to provide the 'hg children' command
1 # Mercurial extension to provide the 'hg children' command
2 #
2 #
3 # Copyright 2007 by Intevation GmbH <intevation@intevation.de>
3 # Copyright 2007 by Intevation GmbH <intevation@intevation.de>
4 #
4 #
5 # Author(s):
5 # Author(s):
6 # Thomas Arendsen Hein <thomas@intevation.de>
6 # Thomas Arendsen Hein <thomas@intevation.de>
7 #
7 #
8 # This software may be used and distributed according to the terms of the
8 # This software may be used and distributed according to the terms of the
9 # GNU General Public License version 2 or any later version.
9 # GNU General Public License version 2 or any later version.
10
10
11 '''command to display child changesets (DEPRECATED)
11 '''command to display child changesets (DEPRECATED)
12
12
13 This extension is deprecated. You should use `hg log -r "children($revision)"`
13 This extension is deprecated. You should use :hg:`log -r
14 instead.
14 "children(REV)"` instead.
15 '''
15 '''
16
16
17 from mercurial import cmdutil
17 from mercurial import cmdutil
18 from mercurial.commands import templateopts
18 from mercurial.commands import templateopts
19 from mercurial.i18n import _
19 from mercurial.i18n import _
20
20
21
21
22 def children(ui, repo, file_=None, **opts):
22 def children(ui, repo, file_=None, **opts):
23 """show the children of the given or working directory revision
23 """show the children of the given or working directory revision
24
24
25 Print the children of the working directory's revisions. If a
25 Print the children of the working directory's revisions. If a
26 revision is given via -r/--rev, the children of that revision will
26 revision is given via -r/--rev, the children of that revision will
27 be printed. If a file argument is given, revision in which the
27 be printed. If a file argument is given, revision in which the
28 file was last changed (after the working directory revision or the
28 file was last changed (after the working directory revision or the
29 argument to --rev if given) is printed.
29 argument to --rev if given) is printed.
30 """
30 """
31 rev = opts.get('rev')
31 rev = opts.get('rev')
32 if file_:
32 if file_:
33 ctx = repo.filectx(file_, changeid=rev)
33 ctx = repo.filectx(file_, changeid=rev)
34 else:
34 else:
35 ctx = repo[rev]
35 ctx = repo[rev]
36
36
37 displayer = cmdutil.show_changeset(ui, repo, opts)
37 displayer = cmdutil.show_changeset(ui, repo, opts)
38 for cctx in ctx.children():
38 for cctx in ctx.children():
39 displayer.show(cctx)
39 displayer.show(cctx)
40 displayer.close()
40 displayer.close()
41
41
42 cmdtable = {
42 cmdtable = {
43 "children":
43 "children":
44 (children,
44 (children,
45 [('r', 'rev', '',
45 [('r', 'rev', '',
46 _('show children of the specified revision'), _('REV')),
46 _('show children of the specified revision'), _('REV')),
47 ] + templateopts,
47 ] + templateopts,
48 _('hg children [-r REV] [FILE]')),
48 _('hg children [-r REV] [FILE]')),
49 }
49 }
General Comments 0
You need to be logged in to leave comments. Login now