1. TortoiseHg
  2. TortoiseHg
  3. thg

Commits

Hidetaka Iwata  committed 224ed11

graph: draw starting edge of topo branch in same color as its descendants

draw asterisked edge in the color same as right line, not left
| |
| o
|/*
o

as a side effect, common edge(asterisked edge) is drawn in right line color now
this behaviour will be fixed soon.
| o
|/
|*
o

  • Participants
  • Parent commits 7ad6d98
  • Branches default

Comments (0)

Files changed (2)

File tests/graph_test.py

View file
  • Ignore whitespace
                               # | 4 |
         4: [c0, c1, c2],      # | | |
                               # | | 3
-        3: [c0, c1, c1],      # | |/
+        3: [c0, c1, c2],      # | |/
                               # 2 |
-        2: [c0, c1],          # | |
+        2: [c0, c2],          # | |
                               # | 1
-        1: [c0, c0],          # |/
+        1: [c0, c1],          # |/
                               # 0
         0: [],
         }
                       # | 5
         5: [c0, c1],  # | |
                       # | 4
-        4: [c0, c0],  # | |
+        4: [c0, c1],  # | |
                       # 3 |
-        3: [c0, c0],  # |/
+        3: [c0, c1],  # |/
                       # 1
         1: [c0],      # |
                       # 0
                               # | 4 |
         4: [c0, c1, c2],      # | | |
                               # | | 3
-        3: [c0, c1, c1],      # | |/
+        3: [c0, c1, c2],      # | |/
                               # 2 |
-        2: [c0, c1],          # | |
+        2: [c0, c2],          # | |
                               # | 1
-        1: [c0, c0],          # |/
+        1: [c0, c1],          # |/
                               # 0
         0: [],
         }
                               # | 4 |
         4: [c0, c1, c2],      # | | |
                               # | | 3
-        3: [c0, c1, c1],      # | |/
+        3: [c0, c1, c2],      # | |/
                               # 2 |
-        2: [c0, c1],          # | |
+        2: [c0, c2],          # | |
                               # | 1
-        1: [c0, c0],          # |/
+        1: [c0, c1],          # |/
                               # 0
         0: [],
         }
                               #   4
         4: [c1],              #   |
                               #   2
-        2: [c0],              #  /
+        2: [c1],              #  /
                               # 1
         1: [c0],              # |
                               # 0
                               # | 3
         3: [c1, c0],          # | |
                               # 2 |
-        2: [c0, c0],          # |/
+        2: [c1, c0],          # |/
                               # 1
         1: [c0],              # |
                               # 0
                               # 3
         3: [c0],              # |
                               # | 2
-        2: [c0, c0],          # |/
+        2: [c0, c1],          # |/
                               # 1
         1: [c0],              # |
                               # 0

File tortoisehg/hgqt/graph.py

View file
  • Ignore whitespace
         activeedges = [e for e in activeedges if e.endrev < curr_rev]
 
         # Add parents to next_revs.
-        parents = [(p, LINE_TYPE_PARENT) for p in getparents(ctx)
+        parents = [(p, LINE_TYPE_PARENT, i == 0)
+                   for i, p in enumerate(getparents(ctx))
                    if not hidden(p.rev())]
         if showgraftsource:
             src_rev_str = ctx.extra().get('source')
                 src = repo[src_rev_str]
                 src_rev = src.rev()
                 if stop_rev <= src_rev < curr_rev and not hidden(src_rev):
-                    parents.append((src, LINE_TYPE_GRAFT))
+                    parents.append((src, LINE_TYPE_GRAFT, False))
             for octx in obsoleteutil.first_known_precursors(ctx):
                 src_rev = octx.rev()
                 if stop_rev <= src_rev < curr_rev and not hidden(src_rev):
-                    parents.append((octx, LINE_TYPE_OBSOLETE))
+                    parents.append((octx, LINE_TYPE_OBSOLETE, False))
         parents_to_add = []
-        for pctx, link_type in parents:
+        for pctx, link_type, is_p1 in parents:
             parent = pctx.rev()
             if parent not in next_revs:
                 # Because the parents originate from multiple sources, it is
                 if parent in parents_to_add:
                     continue
                 parents_to_add.append(parent)
-            color = rev_color[pctx]
+            if is_p1:
+                color = rev_color[ctx]
+            else:
+                color = rev_color[pctx]
             activeedges.append(GraphEdge(curr_rev, parent, color, link_type))
 
         # parents_to_add.sort()
                 # and probably longer line is major line.
                 if pno == 0 and curcolor < rev_color[parent]:
                     rev_color[parent] = curcolor
-
-            activeedges.append(GraphEdge(rev, parent, rev_color[parent]))
+            if pno == 0:
+                color = curcolor
+            else:
+                color = rev_color[parent]
+            activeedges.append(GraphEdge(rev, parent, color))
         parents_to_add.sort()
         next_revs[index:index + 1] = parents_to_add