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
|
|
|
|
2014-05-05 09:25:28 +04:00
|
|
|
from mercurial import cmdutil
|
2008-02-29 04:45:12 +03:00
|
|
|
from mercurial.commands import templateopts
|
2007-07-03 14:14:25 +04:00
|
|
|
from mercurial.i18n import _
|
|
|
|
|
2014-05-05 08:46:49 +04:00
|
|
|
cmdtable = {}
|
|
|
|
command = cmdutil.command(cmdtable)
|
2012-05-15 23:37:49 +04:00
|
|
|
testedwith = 'internal'
|
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.
|
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()
|