[PATCH] graphlog: remove rev from parents (issue3772)

Sean Farley sean.michael.farley at gmail.com
Mon Jan 21 21:40:59 CST 2013


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1358822771 21600
# Branch stable
# Node ID 9d793a83323921bc6213fce8ea2cb79a16d37955
# Parent  9354a8c1bdedec8e60d9b00aeba7cd2a4bd681a0
graphlog: remove rev from parents (issue3772)

The list of parents could contain rev, thereby forming a cycle in the
graph. This patch simply removes rev from the list of parents.

diff --git a/mercurial/graphmod.py b/mercurial/graphmod.py
--- a/mercurial/graphmod.py
+++ b/mercurial/graphmod.py
@@ -168,10 +168,14 @@
     """adds edge info to changelog DAG walk suitable for ascii()"""
     if rev not in seen:
         seen.append(rev)
     nodeidx = seen.index(rev)
 
+    # remove rev from parents (which can happen when rev == nullrev)
+    if rev in parents:
+        parents.remove(rev)
+
     knownparents = []
     newparents = []
     for parent in parents:
         if parent in seen:
             knownparents.append(parent)


More information about the Mercurial-devel mailing list