##// END OF EJS Templates
children: migrate `opts` to native kwargs
Matt Harbison -
r51764:0c76520e default
parent child Browse files
Show More
@@ -1,82 +1,83 b''
1 1 # Mercurial extension to provide the 'hg children' command
2 2 #
3 3 # Copyright 2007 by Intevation GmbH <intevation@intevation.de>
4 4 #
5 5 # Author(s):
6 6 # Thomas Arendsen Hein <thomas@intevation.de>
7 7 #
8 8 # This software may be used and distributed according to the terms of the
9 9 # GNU General Public License version 2 or any later version.
10 10
11 11 '''command to display child changesets (DEPRECATED)
12 12
13 13 This extension is deprecated. You should use :hg:`log -r
14 14 "children(REV)"` instead.
15 15 '''
16 16
17 17
18 18 from mercurial.i18n import _
19 19 from mercurial import (
20 20 cmdutil,
21 21 logcmdutil,
22 22 pycompat,
23 23 registrar,
24 24 )
25 25
26 26 templateopts = cmdutil.templateopts
27 27
28 28 cmdtable = {}
29 29 command = registrar.command(cmdtable)
30 30 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
31 31 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
32 32 # be specifying the version(s) of Mercurial they are tested with, or
33 33 # leave the attribute unspecified.
34 34 testedwith = b'ships-with-hg-core'
35 35
36 36
37 37 @command(
38 38 b'children',
39 39 [
40 40 (
41 41 b'r',
42 42 b'rev',
43 43 b'.',
44 44 _(b'show children of the specified revision'),
45 45 _(b'REV'),
46 46 ),
47 47 ]
48 48 + templateopts,
49 49 _(b'hg children [-r REV] [FILE]'),
50 50 helpcategory=command.CATEGORY_CHANGE_NAVIGATION,
51 51 inferrepo=True,
52 52 )
53 53 def children(ui, repo, file_=None, **opts):
54 54 """show the children of the given or working directory revision
55 55
56 56 Print the children of the working directory's revisions. If a
57 57 revision is given via -r/--rev, the children of that revision will
58 58 be printed. If a file argument is given, revision in which the
59 59 file was last changed (after the working directory revision or the
60 60 argument to --rev if given) is printed.
61 61
62 62 Please use :hg:`log` instead::
63 63
64 64 hg children => hg log -r "children(.)"
65 65 hg children -r REV => hg log -r "children(REV)"
66 66
67 67 See :hg:`help log` and :hg:`help revsets.children`.
68 68
69 69 """
70 opts = pycompat.byteskwargs(opts)
71 rev = opts.get(b'rev')
70 rev = opts.get('rev')
72 71 ctx = logcmdutil.revsingle(repo, rev)
73 72 if file_:
74 73 fctx = repo.filectx(file_, changeid=ctx.rev())
75 74 childctxs = [fcctx.changectx() for fcctx in fctx.children()]
76 75 else:
77 76 childctxs = ctx.children()
78 77
79 displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
78 displayer = logcmdutil.changesetdisplayer(
79 ui, repo, pycompat.byteskwargs(opts)
80 )
80 81 for cctx in childctxs:
81 82 displayer.show(cctx)
82 83 displayer.close()
General Comments 0
You need to be logged in to leave comments. Login now