diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py --- a/mercurial/obsutil.py +++ b/mercurial/obsutil.py @@ -562,9 +562,9 @@ # remove duplicated and subset seen = [] final = [] - candidate = sorted((s for s in succssets if s), + candidates = sorted((s for s in succssets if s), key=len, reverse=True) - for cand in candidate: + for cand in candidates: for seensuccs in seen: if cand.canmerge(seensuccs): seensuccs.markers.update(cand.markers)