hgk: Use $HG instead of hg (see 849f011dbf79)
authorThomas Arendsen Hein <thomas@intevation.de>
Sat, 23 Jun 2007 21:10:55 +0200
changeset 4688 39001f4b7d99
parent 4687 b5bbfa18daf7
child 4689 54a2b94a372c
hgk: Use $HG instead of hg (see 849f011dbf79)
contrib/hgk
hgext/hgk.py
--- a/contrib/hgk	Sat Jun 23 20:22:17 2007 +0200
+++ b/contrib/hgk	Sat Jun 23 21:10:55 2007 +0200
@@ -43,7 +43,7 @@
     }
     if [catch {
 	set parse_args [concat --default HEAD $revargs]
-	set parse_temp [eval exec hg debug-rev-parse $parse_args]
+	set parse_temp [eval exec {$env(HG)} 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 "|hg debug-rev-list --header --topo-order --parents $parsed_args" r]
+	set commfd [open "|{$env(HG)} debug-rev-list --header --topo-order --parents $parsed_args" r]
     } err] {
 	puts stderr "Error executing hg debug-rev-list: $err"
 	exit 1
@@ -179,7 +179,8 @@
 }
 
 proc readcommit {id} {
-    if [catch {set contents [exec hg debug-cat-file commit $id]}] return
+    global env
+    if [catch {set contents [exec $env(HG) debug-cat-file commit $id]}] return
     parsecommit $id $contents 0 {}
 }
 
@@ -258,9 +259,9 @@
 }
 
 proc readrefs {} {
-    global tagids idtags headids idheads tagcontents
+    global tagids idtags headids idheads tagcontents env
 
-    set tags [exec hg tags]
+    set tags [exec $env(HG) tags]
     regsub -all "\r\n" $tags "\n" tags
     set lines [split $tags "\n"]
     foreach f $lines {
@@ -1713,6 +1714,7 @@
     global findprocpid findprocfile
     global finddidsel ctext lineid findinprogress
     global findinsertpos
+    global env
 
     if {$numcommits == 0} return
 
@@ -1732,7 +1734,7 @@
     }
 
     if {[catch {
-	set f [open [list | hg debug-diff-tree --stdin -s -r -S$findstring \
+	set f [open [list | $env(HG) debug-diff-tree --stdin -s -r -S$findstring \
 			 << $inputids] r]
     } err]} {
 	error_popup "Error starting search process: $err"
@@ -1804,6 +1806,7 @@
     global findinprogress findstartline findinsertpos
     global treediffs fdiffids fdiffsneeded fdiffpos
     global findmergefiles
+    global env
 
     if {$numcommits == 0} return
 
@@ -1835,7 +1838,7 @@
     # start off a git-diff-tree process if needed
     if {$diffsneeded ne {}} {
 	if {[catch {
-	    set df [open [list | hg debug-diff-tree -r --stdin << $diffsneeded] r]
+	    set df [open [list | $env(HG) debug-diff-tree -r --stdin << $diffsneeded] r]
 	} err ]} {
 	    error_popup "Error starting search process: $err"
 	    return
@@ -2252,13 +2255,14 @@
 }
 
 proc findgca {ids} {
+    global env
     set gca {}
     foreach id $ids {
 	if {$gca eq {}} {
 	    set gca $id
 	} else {
 	    if {[catch {
-		set gca [exec hg debug-merge-base $gca $id]
+		set gca [exec $env(HG) debug-merge-base $gca $id]
 	    } err]} {
 		return {}
 	    }
@@ -2332,6 +2336,7 @@
     global cflist diffmergeid mergefilelist parents
     global diffopts diffinhunk currentfile currenthunk filelines
     global diffblocked groupfilelast mergefds groupfilenum grouphunks
+    global env
 
     set files $mergefilelist($diffmergeid)
     foreach f $files {
@@ -2346,7 +2351,7 @@
     catch {unset grouphunks}
     set groupfilelast -1
     foreach p $parents($diffmergeid) {
-	set cmd [list | hg debug-diff-tree -p $p $diffmergeid]
+	set cmd [list | $env(HG) 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"
@@ -2785,12 +2790,12 @@
 }
 
 proc gettreediffs {ids} {
-    global treediff parents treepending
+    global treediff parents treepending env
     set treepending $ids
     set treediff {}
     set id [lindex $ids 0]
     set p [lindex $ids 1]
-    if [catch {set gdtf [open "|hg debug-diff-tree -r $p $id" r]}] return
+    if [catch {set gdtf [open "|{$env(HG)} debug-diff-tree -r $p $id" r]}] return
     fconfigure $gdtf -blocking 0
     fileevent $gdtf readable [list gettreediffline $gdtf $ids]
 }
@@ -2826,7 +2831,7 @@
     set id [lindex $ids 0]
     set p [lindex $ids 1]
     set env(GIT_DIFF_OPTS) $diffopts
-    set cmd [list | hg debug-diff-tree -r -p -C $p $id]
+    set cmd [list | $env(HG) debug-diff-tree -r -p -C $p $id]
     if {[catch {set bdf [open $cmd r]} err]} {
 	puts "error getting diffs: $err"
 	return
@@ -3409,12 +3414,12 @@
 }
 
 proc mkpatchgo {} {
-    global patchtop
+    global patchtop env
 
     set oldid [$patchtop.fromsha1 get]
     set newid [$patchtop.tosha1 get]
     set fname [$patchtop.fname get]
-    if {[catch {exec hg debug-diff-tree -p $oldid $newid >$fname &} err]} {
+    if {[catch {exec $env(HG) debug-diff-tree -p $oldid $newid >$fname &} err]} {
 	error_popup "Error creating patch: $err"
     }
     catch {destroy $patchtop}
@@ -3473,7 +3478,7 @@
 	return
     }
     if {[catch {
-	set out [exec hg tag -r $id $tag]
+	set out [exec $env(HG) tag -r $id $tag]
     } err]} {
 	error_popup "Error creating tag: $err"
 	return
@@ -3549,7 +3554,7 @@
     set id [$wrcomtop.sha1 get]
     set cmd "echo $id | [$wrcomtop.cmd get]"
     set fname [$wrcomtop.fname get]
-    if {[catch {exec sh -c $cmd >$fname &} err]} {
+    if {[catch {exec sh -c $cmd > $fname &} err]} {
 	error_popup "Error writing commit: $err"
     }
     catch {destroy $wrcomtop}
@@ -3635,7 +3640,7 @@
 set datemode 0
 set boldnames 0
 set diffopts "-U 5 -p"
-set wrcomcmd "hg debug-diff-tree --stdin -p --pretty"
+set wrcomcmd "\"\$HG\" debug-diff-tree --stdin -p --pretty"
 
 set mainfont {Helvetica 9}
 set textfont {Courier 9}
--- a/hgext/hgk.py	Sat Jun 23 20:22:17 2007 +0200
+++ b/hgext/hgk.py	Sat Jun 23 21:10:55 2007 +0200
@@ -272,7 +272,7 @@
     optstr = ' '.join(['--%s %s' % (k, v) for k, v in opts.iteritems() if v])
     cmd = ui.config("hgk", "path", "hgk") + " %s %s" % (optstr, " ".join(etc))
     ui.debug("running %s\n" % cmd)
-    os.system(cmd)
+    util.system(cmd)
 
 cmdtable = {
     "^view": (view,