comparison hgext/children.py @ 5352:cc34be74eeec

Merge with crew-stable.
author Bryan O'Sullivan <bos@serpentine.com>
date Sat, 29 Sep 2007 21:10:54 -0700
parents be78ab217109
children cd65a67aff31
comparison
equal deleted inserted replaced
5343:26692d08c2f9 5352:cc34be74eeec
1 # Mercurial extension to provide the 'hg children' command
2 #
3 # Copyright 2007 by Intevation GmbH <intevation@intevation.de>
4 # Author(s):
5 # Thomas Arendsen Hein <thomas@intevation.de>
6 #
7 # This software may be used and distributed according to the terms
8 # of the GNU General Public License, incorporated herein by reference.
9
10 from mercurial import cmdutil
11 from mercurial.i18n import _
12
13
14 def children(ui, repo, file_=None, **opts):
15 """show the children of the given or working dir revision
16
17 Print the children of the working directory's revisions.
18 If a revision is given via --rev, the children of that revision
19 will be printed. If a file argument is given, revision in
20 which the file was last changed (after the working directory
21 revision or the argument to --rev if given) is printed.
22 """
23 rev = opts.get('rev')
24 if file_:
25 ctx = repo.filectx(file_, changeid=rev)
26 else:
27 ctx = repo.changectx(rev)
28
29 displayer = cmdutil.show_changeset(ui, repo, opts)
30 for node in [cp.node() for cp in ctx.children()]:
31 displayer.show(changenode=node)
32
33
34 cmdtable = {
35 "children":
36 (children,
37 [('r', 'rev', '', _('show children of the specified rev')),
38 ('', 'style', '', _('display using template map file')),
39 ('', 'template', '', _('display with template'))],
40 _('hg children [-r REV] [FILE]')),
41 }