Commits

Hidetaka Iwata  committed f093b85

graph: encapsulate sort key of GraphEdge

  • Participants
  • Parent commits bc331a1

Comments (0)

Files changed (3)

File tests/graph_test.py

             continue
         # draw overlapped lines in the same way as HgRepoListModel
         ct = dict((p, e.color) for p, e
-                  in sorted(node.bottomlines, key=lambda pe: -pe[1].linktype))
+                  in sorted(node.bottomlines, key=lambda pe: pe[1].importance))
         # and sort them in (start, end) order
         colors = [c for p, c in sorted(ct.iteritems(), key=lambda pc: pc[0])]
         table[node.rev] = colors

File tortoisehg/hgqt/graph.py

         xs = (self.__class__.__name__,) + self
         return '%s(%r->%r, color=%r, linktype=%r)' % xs
 
+    @property
+    def importance(self):
+        return -self[3]
+
 class GraphNode(object):
     """
     Simple class to encapsulate a hg node in the revision graph. Does

File tortoisehg/hgqt/repomodel.py

 
             # merging lines should be drawn last (=lowest linktype)
             lines = sorted(((isactive(e), p, e) for p, e in lines),
-                           key=lambda ape: (ape[0], -ape[2].linktype))
+                           key=lambda ape: (ape[0], ape[2].importance))
 
             for active, (start, end), e in lines:
                 lpen = QPen(QColor(active and get_color(e.color) or "gray"))