# HG changeset patch
# User diego@diegooliveira.com
# Date 1254233962 10800
# Node ID 7d6ec2439aed10b405703fcd60af2dc9d6e78149
# Parent  b012c6819dd06abaaf5f485592b8abdfa87764d5
history: show incomming/outgoing changes arrows

diff -r b012c6819dd0 -r 7d6ec2439aed tortoisehg/hgtk/logview/graphcell.py
--- a/tortoisehg/hgtk/logview/graphcell.py	Mon Sep 28 14:41:24 2009 +0200
+++ b/tortoisehg/hgtk/logview/graphcell.py	Tue Sep 29 11:19:22 2009 -0300
@@ -169,11 +169,30 @@
                          start, end, colour, style)
 
         # Draw the revision node in the right column
-        (column, colour) = self.node
-        ctx.arc(cell_area.x + box_size * column + box_size / 2,
-                cell_area.y + cell_area.height / 2,
+        (column, colour, status) = self.node
+        arc_start_position_x = cell_area.x + box_size * column + box_size / 2; 
+        arc_start_position_y = cell_area.y + cell_area.height / 2;
+        ctx.arc(arc_start_position_x, arc_start_position_y,
                 box_size / 5, 0, 2 * math.pi)
 
+        if status != 0:
+            arrow_y = arc_start_position_y - box_size / 4
+            arrow_x = arc_start_position_x + 7;
+            ctx.rectangle(arrow_x, arrow_y , 2, 5)
+            if status == 1:
+                ctx.move_to(arrow_x - 2, arrow_y + 5)
+                ctx.line_to(arrow_x + 4, arrow_y + 5)
+                ctx.line_to(arrow_x +1, arrow_y + 8)
+                ctx.line_to(arrow_x - 2, arrow_y + 5)
+                ctx.stroke_preserve()
+            elif status == -1:
+                ctx.move_to(arrow_x - 2, arrow_y)
+                ctx.line_to(arrow_x + 4, arrow_y)
+                ctx.line_to(arrow_x +1, arrow_y - 3)
+                ctx.line_to(arrow_x - 2, arrow_y)
+                ctx.stroke_preserve()
+            
+            
         self.set_colour(ctx, colour, 0.0, 0.5)
         ctx.stroke_preserve()
 
diff -r b012c6819dd0 -r 7d6ec2439aed tortoisehg/hgtk/logview/revgraph.py
--- a/tortoisehg/hgtk/logview/revgraph.py	Mon Sep 28 14:41:24 2009 +0200
+++ b/tortoisehg/hgtk/logview/revgraph.py	Tue Sep 29 11:19:22 2009 -0300
@@ -124,7 +124,8 @@
 type_LOOSE_LOW = 1
 type_LOOSE_HIGH = 2
 
-def revision_grapher(repo, start_rev, stop_rev, branch=None, noheads=False, branch_color=False):
+def revision_grapher(repo, start_rev, stop_rev, branch=None, noheads=False, branch_color=False, 
+                     original_tip=-1, outgoing=None):
     """incremental revision grapher
 
     This grapher generates a full graph where every edge is visible.
@@ -191,7 +192,18 @@
                     color = rev_color[parent]
                     lines.append( (i, next_revs.index(parent), color, type_PLAIN) )
 
-        yield (curr_rev, (rev_index, rev_color[curr_rev]), lines, None)
+        status = 0;
+        if  original_tip > -1 and int(curr_rev) >= original_tip:
+            status = 1
+        
+        ctx = repo[curr_rev]
+        node = ctx.node()
+        
+        if outgoing and node in outgoing:
+            status = -1
+        
+            
+        yield (curr_rev, (rev_index, rev_color[curr_rev], status), lines, None)
         revs = next_revs
         curr_rev -= 1
 
diff -r b012c6819dd0 -r 7d6ec2439aed tortoisehg/hgtk/logview/treeview.py
--- a/tortoisehg/hgtk/logview/treeview.py	Mon Sep 28 14:41:24 2009 +0200
+++ b/tortoisehg/hgtk/logview/treeview.py	Tue Sep 29 11:19:22 2009 -0300
@@ -174,7 +174,7 @@
                     only_branch, self.branch_color)
             else:
                 self.grapher = revision_grapher(self.repo, start, end,
-                        only_branch, noheads, self.branch_color)
+                        only_branch, noheads, self.branch_color, self.origtip, self.outgoing)
         elif opts.get('revlist', None):
             self.grapher = dumb_log_generator(self.repo, opts['revlist'])
         else:
@@ -525,7 +525,8 @@
 
     def text_color_orig(self, parents, rev, author):
         if int(rev) >= self.origtip:
-            return 'darkgreen'
+            return 'darkblue'
+            #return 'darkgreen'
         if len(parents) == 2:
             # mark merge changesets blue
             return 'blue'
@@ -544,7 +545,8 @@
 
     def text_color_author(self, parents, rev, author):
         if int(rev) >= self.origtip:
-            return 'darkgreen'
+            return 'blue'
+            #return 'darkgreen'
         for re, v in self.author_pats:
             if (re.search(author)):
                 return v
