diff contrib/hgk @ 4740:e1d1b22bab57

Use "--config ui.report_untrusted=false" for hg calls in hgk, fixes issue523. tcl's exec yields an error if output to stderr happens and isn't redirected to a file, so the warnings about untrusted .hg/hgrc caused problems in hgk. The warning is still printed when executing 'hg view', so the user can see it when using it from the shell.
author Thomas Arendsen Hein <thomas@intevation.de>
date Sun, 01 Jul 2007 15:22:49 +0200
parents 39001f4b7d99
children 4a84f7421692
line wrap: on
line diff
--- a/contrib/hgk	Fri Jun 29 11:13:36 2007 +0200
+++ b/contrib/hgk	Sun Jul 01 15:22:49 2007 +0200
@@ -43,7 +43,7 @@
     }
     if [catch {
 	set parse_args [concat --default HEAD $revargs]
-	set parse_temp [eval exec {$env(HG)} debug-rev-parse $parse_args]
+	set parse_temp [eval exec {$env(HG)} --config ui.report_untrusted=false debug-rev-parse $parse_args]
 	regsub -all "\r\n" $parse_temp "\n" parse_temp
 	set parsed_args [split $parse_temp "\n"]
     } err] {
@@ -57,7 +57,7 @@
 	set parsed_args [concat -n $limit $parsed_args]
     }
     if [catch {
-	set commfd [open "|{$env(HG)} debug-rev-list --header --topo-order --parents $parsed_args" r]
+	set commfd [open "|{$env(HG)} --config ui.report_untrusted=false debug-rev-list --header --topo-order --parents $parsed_args" r]
     } err] {
 	puts stderr "Error executing hg debug-rev-list: $err"
 	exit 1
@@ -180,7 +180,7 @@
 
 proc readcommit {id} {
     global env
-    if [catch {set contents [exec $env(HG) debug-cat-file commit $id]}] return
+    if [catch {set contents [exec $env(HG) --config ui.report_untrusted=false debug-cat-file commit $id]}] return
     parsecommit $id $contents 0 {}
 }
 
@@ -261,7 +261,7 @@
 proc readrefs {} {
     global tagids idtags headids idheads tagcontents env
 
-    set tags [exec $env(HG) tags]
+    set tags [exec $env(HG) --config ui.report_untrusted=false tags]
     regsub -all "\r\n" $tags "\n" tags
     set lines [split $tags "\n"]
     foreach f $lines {
@@ -1734,8 +1734,7 @@
     }
 
     if {[catch {
-	set f [open [list | $env(HG) debug-diff-tree --stdin -s -r -S$findstring \
-			 << $inputids] r]
+	set f [open [list | $env(HG) --config ui.report_untrusted=false debug-diff-tree --stdin -s -r -S$findstring << $inputids] r]
     } err]} {
 	error_popup "Error starting search process: $err"
 	return
@@ -1838,7 +1837,7 @@
     # start off a git-diff-tree process if needed
     if {$diffsneeded ne {}} {
 	if {[catch {
-	    set df [open [list | $env(HG) debug-diff-tree -r --stdin << $diffsneeded] r]
+	    set df [open [list | $env(HG) --config ui.report_untrusted=false debug-diff-tree -r --stdin << $diffsneeded] r]
 	} err ]} {
 	    error_popup "Error starting search process: $err"
 	    return
@@ -2262,7 +2261,7 @@
 	    set gca $id
 	} else {
 	    if {[catch {
-		set gca [exec $env(HG) debug-merge-base $gca $id]
+		set gca [exec $env(HG) --config ui.report_untrusted=false debug-merge-base $gca $id]
 	    } err]} {
 		return {}
 	    }
@@ -2351,7 +2350,7 @@
     catch {unset grouphunks}
     set groupfilelast -1
     foreach p $parents($diffmergeid) {
-	set cmd [list | $env(HG) debug-diff-tree -p $p $diffmergeid]
+	set cmd [list | $env(HG) --config ui.report_untrusted=false debug-diff-tree -p $p $diffmergeid]
 	set cmd [concat $cmd $mergefilelist($diffmergeid)]
 	if {[catch {set f [open $cmd r]} err]} {
 	    error_popup "Error getting diffs: $err"
@@ -2795,7 +2794,7 @@
     set treediff {}
     set id [lindex $ids 0]
     set p [lindex $ids 1]
-    if [catch {set gdtf [open "|{$env(HG)} debug-diff-tree -r $p $id" r]}] return
+    if [catch {set gdtf [open "|{$env(HG)} --config ui.report_untrusted=false debug-diff-tree -r $p $id" r]}] return
     fconfigure $gdtf -blocking 0
     fileevent $gdtf readable [list gettreediffline $gdtf $ids]
 }
@@ -2831,7 +2830,7 @@
     set id [lindex $ids 0]
     set p [lindex $ids 1]
     set env(GIT_DIFF_OPTS) $diffopts
-    set cmd [list | $env(HG) debug-diff-tree -r -p -C $p $id]
+    set cmd [list | $env(HG) --config ui.report_untrusted=false debug-diff-tree -r -p -C $p $id]
     if {[catch {set bdf [open $cmd r]} err]} {
 	puts "error getting diffs: $err"
 	return
@@ -3419,7 +3418,7 @@
     set oldid [$patchtop.fromsha1 get]
     set newid [$patchtop.tosha1 get]
     set fname [$patchtop.fname get]
-    if {[catch {exec $env(HG) debug-diff-tree -p $oldid $newid >$fname &} err]} {
+    if {[catch {exec $env(HG) --config ui.report_untrusted=false debug-diff-tree -p $oldid $newid >$fname &} err]} {
 	error_popup "Error creating patch: $err"
     }
     catch {destroy $patchtop}
@@ -3478,7 +3477,7 @@
 	return
     }
     if {[catch {
-	set out [exec $env(HG) tag -r $id $tag]
+	set out [exec $env(HG) --config ui.report_untrusted=false tag -r $id $tag]
     } err]} {
 	error_popup "Error creating tag: $err"
 	return
@@ -3640,7 +3639,7 @@
 set datemode 0
 set boldnames 0
 set diffopts "-U 5 -p"
-set wrcomcmd "\"\$HG\" debug-diff-tree --stdin -p --pretty"
+set wrcomcmd "\"\$HG\" --config ui.report_untrusted=false debug-diff-tree --stdin -p --pretty"
 
 set mainfont {Helvetica 9}
 set textfont {Courier 9}