Patchwork [3,of,3] hgk: display obsolete changesets in darkgrey

login
register
mail settings
Submitter Andrew Shadura
Date March 28, 2015, 7:55 p.m.
Message ID <709e37bf38838ef41525.1427572557@localhost.localdomain>
Download mbox | patch
Permalink /patch/8335/
State Superseded
Commit 50f5d51ffc9349cf6dd2561bff956c0987c58dfc
Headers show

Comments

Andrew Shadura - March 28, 2015, 7:55 p.m.
# HG changeset patch
# User Andrew Shadura <andrew@shadura.me>
# Date 1427569501 -3600
#      Sat Mar 28 20:05:01 2015 +0100
# Node ID 709e37bf38838ef41525cfb7be6c5b4018b041a5
# Parent  d3e8a551b5ed476ac05fd124da35351ef0fb7a8b
hgk: display obsolete changesets in darkgrey
Gregory Szorc - March 28, 2015, 10:36 p.m.
On Sat, Mar 28, 2015 at 12:55 PM, Andrew Shadura <andrew@shadura.me> wrote:

> # HG changeset patch
> # User Andrew Shadura <andrew@shadura.me>
> # Date 1427569501 -3600
> #      Sat Mar 28 20:05:01 2015 +0100
> # Node ID 709e37bf38838ef41525cfb7be6c5b4018b041a5
> # Parent  d3e8a551b5ed476ac05fd124da35351ef0fb7a8b
> hgk: display obsolete changesets in darkgrey
>
> 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._enabled:
> +        if ctx.obsolete():
> +            ui.write(("obsolete\n"))
>
>
obsolete._enabled is deprecated and all known consumers were recently
purged.

Use "obsolete.isenabled(repo, obsolete.createmarkersopt)"
Andrew Shadura - March 28, 2015, 11:21 p.m.
Hello,

On Sat, 28 Mar 2015 15:36:23 -0700
Gregory Szorc <gregory.szorc@gmail.com> wrote:

> > @@ -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._enabled:
> > +        if ctx.obsolete():
> > +            ui.write(("obsolete\n"))

> obsolete._enabled is deprecated and all known consumers were recently
> purged.

> Use "obsolete.isenabled(repo, obsolete.createmarkersopt)"

Thanks. I'll update the patch.

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._enabled:
+        if ctx.obsolete():
+            ui.write(("obsolete\n"))
     ui.write(("phase %s\n\n" % ctx.phasestr()))
 
     if prefix != "":