Changeset - 6834e1265415
[Not reviewed]
default
0 1 0
Mads Kiilerich - 7 years ago 2018-10-29 01:20:21
mads@kiilerich.com
graph: don't try to get obsolete status for fake parent revisions

Fake parents use negative revision numbers as internal placeholders.
Previous Mercurial versions could handle negative non-existing revision
numbers, but Mercurial 4.8 will fail on this invalid input when getting the
obsolete status.
Instead, make sure we only get obsolete status for actual revisions.
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/graphmod.py
Show inline comments
 
@@ -128,49 +128,49 @@ def _colored(repo, dag):
 
            obs[rev] = int(repo[rev].obsolete)
 
            newcolor += 1
 

	
 
        col = row.index(rev)
 
        addparents = [p for p in dagparents if p not in row]
 

	
 
        # Add unknown parents to nextrow
 
        tmprow = row[:]
 
        tmprow[col:col + 1] = reversed(addparents) # highest revs first (to the right), dead ends last (to the left)
 
        # Filter old fake parents but keep new ones
 
        nextrow = []
 
        for r in tmprow:
 
            if r >= 0 or r in dagparents:
 
                nextrow.append(r)
 
            else:
 
                colors.pop(r)
 
                obs.pop(r)
 

	
 
        # Let color and obs for this rev be "inherited" by the first "parent"
 
        color = colors.pop(rev)
 
        if addparents:
 
            b = branch(rev)
 
            searching = True
 
            for p in reversed(addparents):
 
                obs[p] = int(repo[p].obsolete)
 
                obs[p] = int(repo[p].obsolete) if p >= 0 else 0
 
                if searching and branch(abs(p)) in [b, None]:
 
                    # This is the first parent on the same branch - inherit the color
 
                    colors[p] = color
 
                    searching = False # make sure we don't give the color away twice
 
                else:
 
                    colors[p] = newcolor
 
                    newcolor += 1
 

	
 
        # Add edges to the graph
 
        edges = []
 
        for ecol, ep in enumerate(row):
 
            if ep in nextrow:
 
                edges.append((ecol, nextrow.index(ep), colors[ep], obs[ep]))
 
            elif ep == rev:
 
                for p in dagparents:
 
                    edges.append((ecol, nextrow.index(p), colors[p], obs[p]))
 

	
 
        # Yield and move on
 
        closing = int(repo[rev].closesbranch)
 
        obsolete = int(repo[rev].obsolete)
 
        bumped = int(repo[rev].bumped)
 
        divergent = int(repo[rev].divergent)
 
        extinct = int(repo[rev].extinct)
 
        unstable = int(repo[rev].unstable)
0 comments (0 inline, 0 general)