[PATCH 1 of 3] hgk: show secret changesets differently (shape and label)

Andrew Shadura andrew at shadura.me
Sun Mar 29 17:17:58 UTC 2015


# HG changeset patch
# User Andrew Shadura <andrew at shadura.me>
# Date 1427647493 -7200
#      Sun Mar 29 18:44:53 2015 +0200
# Node ID d27cc4dd70966845cc368fd5d2d9142e2ecacadc
# Parent  7a4f33772e85cb69c3ef38054ae7200cc9d33d22
hgk: show secret changesets differently (shape and label)

diff --git a/contrib/hgk b/contrib/hgk
--- a/contrib/hgk
+++ b/contrib/hgk
@@ -391,6 +391,8 @@ proc parsecommit {id contents listed old
 		    set bookmark [join [lrange $line 1 end]]
         } elseif {$tag == "obsolete"} {
 		    set obsolete($id) ""
+        } elseif {$tag == "phase"} {
+		    set phase [lindex $line 1 end]
         }
 	    }
 	} else {
@@ -415,7 +417,7 @@ proc parsecommit {id contents listed old
 	set comdate [clock format $comdate]
     }
     set commitinfo($id) [list $headline $auname $audate \
-			     $comname $comdate $comment $rev $branch $bookmark]
+			     $comname $comdate $comment $rev $branch $bookmark $phase]
 
     if {[info exists firstparents]} {
         set i [lsearch $firstparents $id]
@@ -1149,6 +1151,7 @@ proc drawcommitline {level} {
     set lastuse($id) $lineno
     set lineid($lineno) $id
     set idline($id) $lineno
+    set shape oval
     set ofill [expr {[info exists commitlisted($id)]? "blue": "white"}]
     if {![info exists commitinfo($id)]} {
 	readcommit $id
@@ -1156,6 +1159,10 @@ proc drawcommitline {level} {
 	    set commitinfo($id) {"No commit information available"}
 	    set nparents($id) 0
 	}
+    } else {
+	if {[lindex $commitinfo($id) 9] eq "secret"} {
+	    set shape rect
+	}
     }
     if {[info exists obsolete($id)]} {
 	set ofill darkgrey
@@ -1186,7 +1193,7 @@ proc drawcommitline {level} {
     }
     drawlines $id 0
     set orad [expr {$linespc / 3}]
-    set t [$canv create oval [expr $x - $orad] [expr $y1 - $orad] \
+    set t [$canv create $shape [expr $x - $orad] [expr $y1 - $orad] \
 	       [expr $x + $orad - 1] [expr $y1 + $orad - 1] \
 	       -fill $ofill -outline black -width 1]
     $canv raise $t
@@ -2531,6 +2538,12 @@ proc selectline {l isnew} {
 	    append comment "Child:  [commit_descriptor $c]\n"
 	}
     }
+
+    if {[lindex $info 9] eq "secret"} {
+	# for now, display phase for secret changesets only
+	append comment "Phase: [lindex $info 9]\n"
+    }
+
     append comment "\n"
     append comment [lindex $info 5]
 


More information about the Mercurial-devel mailing list