eggs/mercurial-1.7.3-py2.6-linux-x86_64.egg/hgext/children.py
changeset 69 c6bca38c1cbf
equal deleted inserted replaced
68:5ff1fc726848 69:c6bca38c1cbf
       
     1 # Mercurial extension to provide the 'hg children' command
       
     2 #
       
     3 # Copyright 2007 by Intevation GmbH <intevation@intevation.de>
       
     4 #
       
     5 # Author(s):
       
     6 # Thomas Arendsen Hein <thomas@intevation.de>
       
     7 #
       
     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.
       
    10 
       
    11 '''command to display child changesets'''
       
    12 
       
    13 from mercurial import cmdutil
       
    14 from mercurial.commands import templateopts
       
    15 from mercurial.i18n import _
       
    16 
       
    17 
       
    18 def children(ui, repo, file_=None, **opts):
       
    19     """show the children of the given or working directory revision
       
    20 
       
    21     Print the children of the working directory's revisions. If a
       
    22     revision is given via -r/--rev, the children of that revision will
       
    23     be printed. If a file argument is given, revision in which the
       
    24     file was last changed (after the working directory revision or the
       
    25     argument to --rev if given) is printed.
       
    26     """
       
    27     rev = opts.get('rev')
       
    28     if file_:
       
    29         ctx = repo.filectx(file_, changeid=rev)
       
    30     else:
       
    31         ctx = repo[rev]
       
    32 
       
    33     displayer = cmdutil.show_changeset(ui, repo, opts)
       
    34     for cctx in ctx.children():
       
    35         displayer.show(cctx)
       
    36     displayer.close()
       
    37 
       
    38 cmdtable = {
       
    39     "children":
       
    40         (children,
       
    41          [('r', 'rev', '',
       
    42            _('show children of the specified revision'), _('REV')),
       
    43          ] + templateopts,
       
    44          _('hg children [-r REV] [FILE]')),
       
    45 }