Show More
@@ -1,69 +1,69 | |||||
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 |
|
13 | This extension is deprecated. You should use :hg:`log -r | |
14 | "children(REV)"` instead. |
|
14 | "children(REV)"` instead. | |
15 | ''' |
|
15 | ''' | |
16 |
|
16 | |||
17 | from __future__ import absolute_import |
|
17 | from __future__ import absolute_import | |
18 |
|
18 | |||
19 | from mercurial.i18n import _ |
|
19 | from mercurial.i18n import _ | |
20 | from mercurial import ( |
|
20 | from mercurial import ( | |
21 | cmdutil, |
|
21 | cmdutil, | |
22 | registrar, |
|
22 | registrar, | |
23 | ) |
|
23 | ) | |
24 |
|
24 | |||
25 | templateopts = cmdutil.templateopts |
|
25 | templateopts = cmdutil.templateopts | |
26 |
|
26 | |||
27 | cmdtable = {} |
|
27 | cmdtable = {} | |
28 | command = registrar.command(cmdtable) |
|
28 | command = registrar.command(cmdtable) | |
29 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
29 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
30 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
30 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
31 | # be specifying the version(s) of Mercurial they are tested with, or |
|
31 | # be specifying the version(s) of Mercurial they are tested with, or | |
32 | # leave the attribute unspecified. |
|
32 | # leave the attribute unspecified. | |
33 | testedwith = 'ships-with-hg-core' |
|
33 | testedwith = 'ships-with-hg-core' | |
34 |
|
34 | |||
35 | @command('children', |
|
35 | @command('children', | |
36 | [('r', 'rev', '', |
|
36 | [('r', 'rev', '', | |
37 | _('show children of the specified revision'), _('REV')), |
|
37 | _('show children of the specified revision'), _('REV')), | |
38 | ] + templateopts, |
|
38 | ] + templateopts, | |
39 | _('hg children [-r REV] [FILE]'), |
|
39 | _('hg children [-r REV] [FILE]'), | |
40 | inferrepo=True) |
|
40 | inferrepo=True) | |
41 | def children(ui, repo, file_=None, **opts): |
|
41 | def children(ui, repo, file_=None, **opts): | |
42 | """show the children of the given or working directory revision |
|
42 | """show the children of the given or working directory revision | |
43 |
|
43 | |||
44 | Print the children of the working directory's revisions. If a |
|
44 | Print the children of the working directory's revisions. If a | |
45 | revision is given via -r/--rev, the children of that revision will |
|
45 | revision is given via -r/--rev, the children of that revision will | |
46 | be printed. If a file argument is given, revision in which the |
|
46 | be printed. If a file argument is given, revision in which the | |
47 | file was last changed (after the working directory revision or the |
|
47 | file was last changed (after the working directory revision or the | |
48 | argument to --rev if given) is printed. |
|
48 | argument to --rev if given) is printed. | |
49 |
|
49 | |||
50 | Please use :hg:`log` instead:: |
|
50 | Please use :hg:`log` instead:: | |
51 |
|
51 | |||
52 | hg children => hg log -r "children()" |
|
52 | hg children => hg log -r "children(.)" | |
53 | hg children -r REV => hg log -r "children(REV)" |
|
53 | hg children -r REV => hg log -r "children(REV)" | |
54 |
|
54 | |||
55 | See :hg:`help log` and :hg:`help revsets.children`. |
|
55 | See :hg:`help log` and :hg:`help revsets.children`. | |
56 |
|
56 | |||
57 | """ |
|
57 | """ | |
58 | rev = opts.get('rev') |
|
58 | rev = opts.get('rev') | |
59 | if file_: |
|
59 | if file_: | |
60 | fctx = repo.filectx(file_, changeid=rev) |
|
60 | fctx = repo.filectx(file_, changeid=rev) | |
61 | childctxs = [fcctx.changectx() for fcctx in fctx.children()] |
|
61 | childctxs = [fcctx.changectx() for fcctx in fctx.children()] | |
62 | else: |
|
62 | else: | |
63 | ctx = repo[rev] |
|
63 | ctx = repo[rev] | |
64 | childctxs = ctx.children() |
|
64 | childctxs = ctx.children() | |
65 |
|
65 | |||
66 | displayer = cmdutil.show_changeset(ui, repo, opts) |
|
66 | displayer = cmdutil.show_changeset(ui, repo, opts) | |
67 | for cctx in childctxs: |
|
67 | for cctx in childctxs: | |
68 | displayer.show(cctx) |
|
68 | displayer.show(cctx) | |
69 | displayer.close() |
|
69 | displayer.close() |
General Comments 0
You need to be logged in to leave comments.
Login now