2007-07-03 14:14:25 +04:00
|
|
|
# Mercurial extension to provide the 'hg children' command
|
|
|
|
#
|
|
|
|
# Copyright 2007 by Intevation GmbH <intevation@intevation.de>
|
2009-04-26 03:25:53 +04:00
|
|
|
#
|
2007-07-03 14:14:25 +04:00
|
|
|
# Author(s):
|
|
|
|
# Thomas Arendsen Hein <thomas@intevation.de>
|
|
|
|
#
|
2009-04-26 03:08:54 +04:00
|
|
|
# This software may be used and distributed according to the terms of the
|
2010-01-20 07:20:08 +03:00
|
|
|
# GNU General Public License version 2 or any later version.
|
2007-07-03 14:14:25 +04:00
|
|
|
|
2012-05-11 15:15:46 +04:00
|
|
|
'''command to display child changesets (DEPRECATED)
|
|
|
|
|
2012-05-11 15:42:37 +04:00
|
|
|
This extension is deprecated. You should use :hg:`log -r
|
|
|
|
"children(REV)"` instead.
|
2012-05-11 15:15:46 +04:00
|
|
|
'''
|
2009-06-21 18:45:47 +04:00
|
|
|
|
2016-02-10 04:34:32 +03:00
|
|
|
from __future__ import absolute_import
|
|
|
|
|
2007-07-03 14:14:25 +04:00
|
|
|
from mercurial.i18n import _
|
2016-02-10 04:34:32 +03:00
|
|
|
from mercurial import (
|
|
|
|
cmdutil,
|
2017-10-22 21:23:10 +03:00
|
|
|
pycompat,
|
2016-01-09 17:07:20 +03:00
|
|
|
registrar,
|
2016-02-10 04:34:32 +03:00
|
|
|
)
|
|
|
|
|
2017-05-14 10:19:47 +03:00
|
|
|
templateopts = cmdutil.templateopts
|
2007-07-03 14:14:25 +04:00
|
|
|
|
2014-05-05 08:46:49 +04:00
|
|
|
cmdtable = {}
|
2016-01-09 17:07:20 +03:00
|
|
|
command = registrar.command(cmdtable)
|
2016-08-23 18:26:08 +03:00
|
|
|
# Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
|
2015-04-28 23:44:37 +03:00
|
|
|
# extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
|
|
|
|
# be specifying the version(s) of Mercurial they are tested with, or
|
|
|
|
# leave the attribute unspecified.
|
2016-08-23 18:26:08 +03:00
|
|
|
testedwith = 'ships-with-hg-core'
|
2007-07-03 14:14:25 +04:00
|
|
|
|
2014-05-05 08:46:49 +04:00
|
|
|
@command('children',
|
|
|
|
[('r', 'rev', '',
|
|
|
|
_('show children of the specified revision'), _('REV')),
|
|
|
|
] + templateopts,
|
2014-05-05 09:25:28 +04:00
|
|
|
_('hg children [-r REV] [FILE]'),
|
|
|
|
inferrepo=True)
|
2007-07-03 14:14:25 +04:00
|
|
|
def children(ui, repo, file_=None, **opts):
|
2009-04-08 00:47:56 +04:00
|
|
|
"""show the children of the given or working directory revision
|
2007-07-03 14:14:25 +04:00
|
|
|
|
2009-07-26 03:40:37 +04:00
|
|
|
Print the children of the working directory's revisions. If a
|
|
|
|
revision is given via -r/--rev, the children of that revision will
|
|
|
|
be printed. If a file argument is given, revision in which the
|
|
|
|
file was last changed (after the working directory revision or the
|
|
|
|
argument to --rev if given) is printed.
|
2016-01-06 20:18:18 +03:00
|
|
|
|
|
|
|
Please use :hg:`log` instead::
|
|
|
|
|
2017-10-31 04:09:38 +03:00
|
|
|
hg children => hg log -r "children(.)"
|
2016-01-06 20:18:18 +03:00
|
|
|
hg children -r REV => hg log -r "children(REV)"
|
2016-01-06 20:18:18 +03:00
|
|
|
|
|
|
|
See :hg:`help log` and :hg:`help revsets.children`.
|
|
|
|
|
2007-07-03 14:14:25 +04:00
|
|
|
"""
|
2017-10-22 21:23:10 +03:00
|
|
|
opts = pycompat.byteskwargs(opts)
|
2007-07-03 14:14:25 +04:00
|
|
|
rev = opts.get('rev')
|
|
|
|
if file_:
|
2015-03-26 17:56:18 +03:00
|
|
|
fctx = repo.filectx(file_, changeid=rev)
|
|
|
|
childctxs = [fcctx.changectx() for fcctx in fctx.children()]
|
2007-07-03 14:14:25 +04:00
|
|
|
else:
|
2008-06-26 23:35:46 +04:00
|
|
|
ctx = repo[rev]
|
2015-03-26 17:56:18 +03:00
|
|
|
childctxs = ctx.children()
|
2007-07-03 14:14:25 +04:00
|
|
|
|
|
|
|
displayer = cmdutil.show_changeset(ui, repo, opts)
|
2015-03-26 17:56:18 +03:00
|
|
|
for cctx in childctxs:
|
2008-11-14 15:59:25 +03:00
|
|
|
displayer.show(cctx)
|
2009-12-28 19:55:52 +03:00
|
|
|
displayer.close()
|