Patchwork graphlog: remove rev from parents (issue3772)

login
register
mail settings
Submitter Sean Farley
Date Jan. 22, 2013, 3:40 a.m.
Message ID <9d793a83323921bc6213.1358826059@laptop.local>
Download mbox | patch
Permalink /patch/706/
State Changes Requested
Headers show

Comments

Sean Farley - Jan. 22, 2013, 3:40 a.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@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.

Patch

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)