[PATCH] hgk: display obsolete changesets in darkgrey

Andrew Shadura andrew at shadura.me
Sun Mar 29 10:57:05 CDT 2015


# HG changeset patch
# User Andrew Shadura <andrew at shadura.me>
# Date 1427569501 -3600
#      Sat Mar 28 20:05:01 2015 +0100
# Node ID a922f3f76a20b6952d39275ff2ab18ccbeb837a9
# Parent  d3e8a551b5ed476ac05fd124da35351ef0fb7a8b
hgk: display obsolete changesets in darkgrey

diff --git a/contrib/hgk b/contrib/hgk
--- a/contrib/hgk
+++ b/contrib/hgk
@@ -337,7 +337,7 @@ proc readcommit {id} {
 
 proc parsecommit {id contents listed olds} {
     global commitinfo children nchildren parents nparents cdate ncleft
-    global firstparents
+    global firstparents obsolete
 
     set inhdr 1
     set comment {}
@@ -389,6 +389,8 @@ proc parsecommit {id contents listed old
 		    set branch [join [lrange $line 1 end]]
         } elseif {$tag == "bookmark"} {
 		    set bookmark [join [lrange $line 1 end]]
+        } elseif {$tag == "obsolete"} {
+		    set obsolete($id) ""
         }
 	    }
 	} else {
@@ -1139,7 +1141,7 @@ proc drawcommitline {level} {
     global lineno lthickness mainline mainlinearrow sidelines
     global commitlisted rowtextx idpos lastuse displist
     global oldnlines olddlevel olddisplist
-    global aucolormap curid curidfont
+    global aucolormap curid curidfont obsolete
 
     incr numcommits
     incr lineno
@@ -1155,6 +1157,9 @@ proc drawcommitline {level} {
 	    set nparents($id) 0
 	}
     }
+    if {[info exists obsolete($id)]} {
+	set ofill darkgrey
+    }
     assigncolor $id
     set currentparents {}
     set dupparents {}
diff --git a/hgext/hgk.py b/hgext/hgk.py
--- a/hgext/hgk.py
+++ b/hgext/hgk.py
@@ -35,7 +35,7 @@ vdiff on hovered and selected revisions.
 '''
 
 import os
-from mercurial import cmdutil, commands, patch, revlog, scmutil
+from mercurial import cmdutil, commands, patch, revlog, scmutil, obsolete
 from mercurial.node import nullid, nullrev, short
 from mercurial.i18n import _
 
@@ -128,6 +128,9 @@ def catcommit(ui, repo, n, prefix, ctx=N
         ui.write(("committer %s %s %s\n" % (committer, int(date[0]), date[1])))
     ui.write(("revision %d\n" % ctx.rev()))
     ui.write(("branch %s\n" % ctx.branch()))
+    if obsolete.isenabled(repo, obsolete.createmarkersopt):
+        if ctx.obsolete():
+            ui.write(("obsolete\n"))
     ui.write(("phase %s\n\n" % ctx.phasestr()))
 
     if prefix != "":


More information about the Mercurial-devel mailing list