Patchwork hgk: display obsolete changesets in darkgrey

login
register
mail settings
Submitter Andrew Shadura
Date March 29, 2015, 3:57 p.m.
Message ID <a922f3f76a20b6952d39.1427644625@localhost.localdomain>
Download mbox | patch
Permalink /patch/8343/
State Accepted
Headers show

Comments

Andrew Shadura - March 29, 2015, 3:57 p.m.
# HG changeset patch
# User Andrew Shadura <andrew@shadura.me>
# Date 1427569501 -3600
#      Sat Mar 28 20:05:01 2015 +0100
# Node ID a922f3f76a20b6952d39275ff2ab18ccbeb837a9
# Parent  d3e8a551b5ed476ac05fd124da35351ef0fb7a8b
hgk: display obsolete changesets in darkgrey
Augie Fackler - March 30, 2015, 6:32 p.m.
On Sun, Mar 29, 2015 at 05:57:05PM +0200, Andrew Shadura wrote:
> # HG changeset patch
> # User Andrew Shadura <andrew@shadura.me>
> # Date 1427569501 -3600
> #      Sat Mar 28 20:05:01 2015 +0100
> # Node ID a922f3f76a20b6952d39275ff2ab18ccbeb837a9
> # Parent  d3e8a551b5ed476ac05fd124da35351ef0fb7a8b
> hgk: display obsolete changesets in darkgrey

Queued this one too, thanks.

>
> 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 != "":
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

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 != "":