# HG changeset patch
# User Bryan O'Sullivan <bryano@fb.com>
# Date 2013-01-23 06:20:26
# Node ID e441657b372bef3569b8bdaeeaa1597e55f684d2
# Parent  ac0c12123743b659bc933e859d408676d05c63e0

graphmod: don't try to visit nullrev (issue3772)

diff --git a/mercurial/graphmod.py b/mercurial/graphmod.py
--- a/mercurial/graphmod.py
+++ b/mercurial/graphmod.py
@@ -181,7 +181,7 @@ def asciiedges(type, char, lines, seen, 
     ncols = len(seen)
     nextseen = seen[:]
     nextseen[nodeidx:nodeidx + 1] = newparents
-    edges = [(nodeidx, nextseen.index(p)) for p in knownparents]
+    edges = [(nodeidx, nextseen.index(p)) for p in knownparents if p != nullrev]
 
     while len(newparents) > 2:
         # ascii() only knows how to add or remove a single column between two
diff --git a/tests/test-glog.t b/tests/test-glog.t
--- a/tests/test-glog.t
+++ b/tests/test-glog.t
@@ -2109,4 +2109,12 @@ The almost-empty template should do some
   o
   
 
+issue3772
+
+  $ hg glog -r :null
+  o  changeset:   -1:000000000000
+     user:
+     date:        Thu Jan 01 00:00:00 1970 +0000
+  
+
   $ cd ..