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
|
|
|
|
2009-06-24 15:42:02 +04:00
|
|
|
'''command to display child changesets'''
|
2009-06-21 18:45:47 +04:00
|
|
|
|
2007-07-03 14:50:05 +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 _
|
|
|
|
|
|
|
|
|
|
|
|
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_:
|
|
|
|
ctx = repo.filectx(file_, changeid=rev)
|
|
|
|
else:
|
2008-06-26 23:35:46 +04:00
|
|
|
ctx = repo[rev]
|
2007-07-03 14:14:25 +04:00
|
|
|
|
|
|
|
displayer = cmdutil.show_changeset(ui, repo, opts)
|
2008-11-14 15:59:25 +03:00
|
|
|
for cctx in ctx.children():
|
|
|
|
displayer.show(cctx)
|
2009-12-28 19:55:52 +03:00
|
|
|
displayer.close()
|
2007-07-03 14:14:25 +04:00
|
|
|
|
|
|
|
cmdtable = {
|
|
|
|
"children":
|
|
|
|
(children,
|
2010-06-06 12:25:00 +04:00
|
|
|
[('r', 'rev', '',
|
|
|
|
_('show children of the specified revision'), _('REV')),
|
2008-02-29 04:45:12 +03:00
|
|
|
] + templateopts,
|
2007-07-03 14:14:25 +04:00
|
|
|
_('hg children [-r REV] [FILE]')),
|
|
|
|
}
|