children extension: Don't abort when looking at the null revision.
authorThomas Arendsen Hein <thomas@intevation.de>
Tue, 03 Jul 2007 12:50:05 +0200
changeset 4785 be78ab217109
parent 4784 7cd8a00d08de
child 4786 4bd0b2f862ba
children extension: Don't abort when looking at the null revision. Since 62c56d8f368b revlog.children only returns real children, so this is no longer a problem.
hgext/children.py
tests/test-children.out
--- a/hgext/children.py	Tue Jul 03 12:46:34 2007 +0200
+++ b/hgext/children.py	Tue Jul 03 12:50:05 2007 +0200
@@ -7,9 +7,8 @@
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
 
-from mercurial import cmdutil, util
+from mercurial import cmdutil
 from mercurial.i18n import _
-from mercurial.node import nullid
 
 
 def children(ui, repo, file_=None, **opts):
@@ -26,9 +25,6 @@
         ctx = repo.filectx(file_, changeid=rev)
     else:
         ctx = repo.changectx(rev)
-    if ctx.node() == nullid:
-        raise util.Abort(_("All non-merge changesets are children of "
-                           "the null revision!"))
 
     displayer = cmdutil.show_changeset(ui, repo, opts)
     for node in [cp.node() for cp in ctx.children()]:
--- a/tests/test-children.out	Tue Jul 03 12:46:34 2007 +0200
+++ b/tests/test-children.out	Tue Jul 03 12:50:05 2007 +0200
@@ -1,6 +1,5 @@
 % init
 % no working directory
-abort: All non-merge changesets are children of the null revision!
 % setup
 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
 % hg children at revision 3 (tip)
@@ -16,7 +15,18 @@
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 % hg children at revision 2 (other head)
 % hg children -r null
-abort: All non-merge changesets are children of the null revision!
+changeset:   0:4df8521a7374
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     0
+
+changeset:   3:e2962852269d
+tag:         tip
+parent:      -1:000000000000
+user:        test
+date:        Thu Jan 01 00:00:03 1970 +0000
+summary:     3
+
 % hg children -r 0
 changeset:   1:708c093edef0
 user:        test