hgext/children.py
changeset 4785 be78ab217109
parent 4783 8b90d763ea90
child 6192 cd65a67aff31
equal deleted inserted replaced
4784:7cd8a00d08de 4785:be78ab217109
     5 # Thomas Arendsen Hein <thomas@intevation.de>
     5 # Thomas Arendsen Hein <thomas@intevation.de>
     6 #
     6 #
     7 # This software may be used and distributed according to the terms
     7 # This software may be used and distributed according to the terms
     8 # of the GNU General Public License, incorporated herein by reference.
     8 # of the GNU General Public License, incorporated herein by reference.
     9 
     9 
    10 from mercurial import cmdutil, util
    10 from mercurial import cmdutil
    11 from mercurial.i18n import _
    11 from mercurial.i18n import _
    12 from mercurial.node import nullid
       
    13 
    12 
    14 
    13 
    15 def children(ui, repo, file_=None, **opts):
    14 def children(ui, repo, file_=None, **opts):
    16     """show the children of the given or working dir revision
    15     """show the children of the given or working dir revision
    17 
    16 
    24     rev = opts.get('rev')
    23     rev = opts.get('rev')
    25     if file_:
    24     if file_:
    26         ctx = repo.filectx(file_, changeid=rev)
    25         ctx = repo.filectx(file_, changeid=rev)
    27     else:
    26     else:
    28         ctx = repo.changectx(rev)
    27         ctx = repo.changectx(rev)
    29     if ctx.node() == nullid:
       
    30         raise util.Abort(_("All non-merge changesets are children of "
       
    31                            "the null revision!"))
       
    32 
    28 
    33     displayer = cmdutil.show_changeset(ui, repo, opts)
    29     displayer = cmdutil.show_changeset(ui, repo, opts)
    34     for node in [cp.node() for cp in ctx.children()]:
    30     for node in [cp.node() for cp in ctx.children()]:
    35         displayer.show(changenode=node)
    31         displayer.show(changenode=node)
    36 
    32