changeset 3619:8c4fd0de5de8

Fix up parent display in logging For changesets with a first parent nullid, but not rev 0, we ought to display a null parent.
author Matt Mackall <mpm@selenic.com>
date Tue, 07 Nov 2006 14:04:15 -0600
parents 3109f012c305
children 535da78ae47b
files mercurial/commands.py tests/test-globalopts.out tests/test-unrelated-pull.out
diffstat 3 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Nov 01 21:47:55 2006 -0600
+++ b/mercurial/commands.py	Tue Nov 07 14:04:15 2006 -0600
@@ -324,12 +324,13 @@
 
         parents = log.parentrevs(rev)
         if not self.ui.debugflag:
-            parents = [p for p in parents if p != nullrev]
-            if len(parents) == 1 and parents[0] == rev-1:
-                parents = []
+            if parents[1] == nullrev:
+                if parents[0] >= rev - 1:
+                    parents = []
+                else:
+                    parents = [parents[0]]
         parents = [(p, hexfunc(log.node(p))) for p in parents]
 
-
         self.ui.write(_("changeset:   %d:%s\n") % (rev, hexfunc(changenode)))
 
         if branch:
--- a/tests/test-globalopts.out	Wed Nov 01 21:47:55 2006 -0600
+++ b/tests/test-globalopts.out	Tue Nov 07 14:04:15 2006 -0600
@@ -27,6 +27,7 @@
 %% abbrev of long option
 changeset:   1:b6c483daf290
 tag:         tip
+parent:      -1:000000000000
 user:        test
 date:        Thu Jan 01 00:00:01 1970 +0000
 summary:     b
@@ -49,6 +50,7 @@
 %% -v/--verbose
 changeset:   1:b6c483daf290
 tag:         tip
+parent:      -1:000000000000
 user:        test
 date:        Thu Jan 01 00:00:01 1970 +0000
 files:       b
--- a/tests/test-unrelated-pull.out	Wed Nov 01 21:47:55 2006 -0600
+++ b/tests/test-unrelated-pull.out	Tue Nov 07 14:04:15 2006 -0600
@@ -11,6 +11,7 @@
 (run 'hg heads' to see heads, 'hg merge' to merge)
 changeset:   1:bdcee5d51fa6
 tag:         tip
+parent:      -1:000000000000
 user:        a
 date:        Mon Jan 12 13:46:40 1970 +0000
 summary:     a