[util] protect first know successors from obsolescence cycle (see #116957)

A changeset could be reported as its own successors. We apply the same fix than in ec7ba95acdab.

G: changed hgviewlib/util.py

authorPierre-Yves David <pierre-yves.david@logilab.fr>
changeset60613a7a2bc0
branchdefault
phasepublic
hiddenno
parent revision#120cbf8fb117 [util] fix first_known_successors computation(closes #117630)
child revision#cfe62937e4b9 [launcher] find hgviewlib automatically (closes #117624), #97b71d561251 [changelog] update changelog for 1.7.0
files modified by this revision
hgviewlib/util.py
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@logilab.fr>
# Date 1359127107 -3600
# Fri Jan 25 16:18:27 2013 +0100
# Node ID 60613a7a2bc00cc118934f0f5733a9dbcbfafc9a
# Parent 120cbf8fb117d5f6682aa611aee296e03a8a666f
[util] protect first know successors from obsolescence cycle (see #116957)

A changeset could be reported as its own successors. We apply the same fix than
in ec7ba95acdab.


G: changed hgviewlib/util.py

diff --git a/hgviewlib/util.py b/hgviewlib/util.py
@@ -152,18 +152,23 @@
1                          candidates.add(mark[0])
2                          seen.add(mark[0])
3 
4  def first_known_successors(ctx, excluded=()):
5      obsstore = getattr(ctx._repo, 'obsstore', None)
6 +    startnode = ctx.node()
7      nm = ctx._repo.changelog.nodemap
8      if obsstore is not None:
9 -        markers = successorsmarkers(obsstore, ctx.node())
10 +        markers = successorsmarkers(obsstore, startnode)
11          # consider all precursors
12          candidates = set()
13          for mark in markers:
14              candidates.update(mark[1])
15          seen = set(candidates)
16 +        if startnode in candidates:
17 +            candidates.remove(startnode)
18 +        else:
19 +            seen.add(startnode)
20          while candidates:
21              current = candidates.pop()
22              # is this changeset in the displayed set ?
23              crev = nm.get(current)
24              if crev is not None and crev not in excluded: