Patchwork [2,of,3] hgk: pass --hidden switch to hg subprocesses when needed

login
register
mail settings
Submitter Andrew Shadura
Date March 28, 2015, 7:55 p.m.
Message ID <d3e8a551b5ed476ac05f.1427572556@localhost.localdomain>
Download mbox | patch
Permalink /patch/8334/
State Accepted
Headers show

Comments

Andrew Shadura - March 28, 2015, 7:55 p.m.
# HG changeset patch
# User Andrew Shadura <andrew@shadura.me>
# Date 1427567781 -3600
#      Sat Mar 28 19:36:21 2015 +0100
# Node ID d3e8a551b5ed476ac05fd124da35351ef0fb7a8b
# Parent  6283d542ce5d7554688d63a496aac525f5bbeb2e
hgk: pass --hidden switch to hg subprocesses when needed
Augie Fackler - March 30, 2015, 6:31 p.m.
On Sat, Mar 28, 2015 at 08:55:56PM +0100, Andrew Shadura wrote:
> # HG changeset patch
> # User Andrew Shadura <andrew@shadura.me>
> # Date 1427567781 -3600
> #      Sat Mar 28 19:36:21 2015 +0100
> # Node ID d3e8a551b5ed476ac05fd124da35351ef0fb7a8b
> # Parent  6283d542ce5d7554688d63a496aac525f5bbeb2e
> hgk: pass --hidden switch to hg subprocesses when needed

I've queued these, thanks.

(I'm gambling a little bit on hgk itself, since I don't really know
what I'm doing, but it seems clear enough.)

>
> diff --git a/contrib/hgk b/contrib/hgk
> --- a/contrib/hgk
> +++ b/contrib/hgk
> @@ -177,12 +177,15 @@ proc getcommits {rargs} {
>      set ncmupdate 1
>      set limit 0
>      set revargs {}
> +    set showhidden no
>      for {set i 0} {$i < [llength $rargs]} {incr i} {
>       set opt [lindex $rargs $i]
> -	if {$opt == "--limit"} {
> +	switch -- $opt --limit {
>           incr i
>           set limit [lindex $rargs $i]
> -	} else {
> +	} --hidden {
> +         set showhidden yes
> +	} default {
>           lappend revargs $opt
>       }
>      }
> @@ -201,6 +204,9 @@ proc getcommits {rargs} {
>      if {$limit > 0} {
>       set parsed_args [concat -n $limit $parsed_args]
>      }
> +    if {$showhidden} {
> +	append parsed_args --hidden
> +    }
>      if [catch {
>       set commfd [open "|{$env(HG)} --config ui.report_untrusted=false debug-rev-list --header --topo-order --parents $parsed_args" r]
>      } err] {
> diff --git a/hgext/hgk.py b/hgext/hgk.py
> --- a/hgext/hgk.py
> +++ b/hgext/hgk.py
> @@ -349,6 +349,9 @@ def view(ui, repo, *etc, **opts):
>      "start interactive history viewer"
>      os.chdir(repo.root)
>      optstr = ' '.join(['--%s %s' % (k, v) for k, v in opts.iteritems() if v])
> +    if repo.filtername is None:
> +        optstr += '--hidden'
> +
>      cmd = ui.config("hgk", "path", "hgk") + " %s %s" % (optstr, " ".join(etc))
>      ui.debug("running %s\n" % cmd)
>      ui.system(cmd)
> _______________________________________________
> 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
@@ -177,12 +177,15 @@  proc getcommits {rargs} {
     set ncmupdate 1
     set limit 0
     set revargs {}
+    set showhidden no
     for {set i 0} {$i < [llength $rargs]} {incr i} {
 	set opt [lindex $rargs $i]
-	if {$opt == "--limit"} {
+	switch -- $opt --limit {
 	    incr i
 	    set limit [lindex $rargs $i]
-	} else {
+	} --hidden {
+	    set showhidden yes
+	} default {
 	    lappend revargs $opt
 	}
     }
@@ -201,6 +204,9 @@  proc getcommits {rargs} {
     if {$limit > 0} {
 	set parsed_args [concat -n $limit $parsed_args]
     }
+    if {$showhidden} {
+	append parsed_args --hidden
+    }
     if [catch {
 	set commfd [open "|{$env(HG)} --config ui.report_untrusted=false debug-rev-list --header --topo-order --parents $parsed_args" r]
     } err] {
diff --git a/hgext/hgk.py b/hgext/hgk.py
--- a/hgext/hgk.py
+++ b/hgext/hgk.py
@@ -349,6 +349,9 @@  def view(ui, repo, *etc, **opts):
     "start interactive history viewer"
     os.chdir(repo.root)
     optstr = ' '.join(['--%s %s' % (k, v) for k, v in opts.iteritems() if v])
+    if repo.filtername is None:
+        optstr += '--hidden'
+
     cmd = ui.config("hgk", "path", "hgk") + " %s %s" % (optstr, " ".join(etc))
     ui.debug("running %s\n" % cmd)
     ui.system(cmd)