[PATCH 8 of 9] hgk: remove some gitisms
Andrew Shadura
bugzilla at tut.by
Wed Nov 7 14:06:50 CST 2012
# HG changeset patch
# User Andrew Shadura <bugzilla at tut.by>
# Date 1350420738 -7200
# Node ID 944e03b68e1f112bc62b54d048e1715b5c84380a
# Parent 854aa1b3fd06d19a91559a2877a9f769d44581bf
hgk: remove some gitisms
Remove references to git/gitk, use ::hgdir instead of [gitdir],
call tip tip, not HEAD.
diff --git a/contrib/hgk b/contrib/hgk
--- a/contrib/hgk
+++ b/contrib/hgk
@@ -125,14 +125,7 @@ if {[tk windowingsystem] eq "aqua"} {
event add <<B3>> <Button-3>
}
-proc gitdir {} {
- global env
- if {[info exists env(GIT_DIR)]} {
- return $env(GIT_DIR)
- } else {
- return ".hg"
- }
-}
+set ::hgdir .hg
proc popupify {w} {
wm resizable $w 0 0
@@ -151,10 +144,9 @@ proc getcommits {rargs} {
global startmsecs nextupdate ncmupdate
global ctext maincursor textcursor leftover
- # check that we can find a .git directory somewhere...
- set gitdir [gitdir]
- if {![file isdirectory $gitdir]} {
- error_popup "Cannot find the git directory \"$gitdir\"."
+ # check that we can find a .hg directory somewhere...
+ if {![file isdirectory $::hgdir]} {
+ error_popup "Cannot find the hg directory \"$::hgdir\"."
exit 1
}
set commits {}
@@ -174,14 +166,14 @@ proc getcommits {rargs} {
}
}
if [catch {
- set parse_args [concat --default HEAD $revargs]
+ set parse_args [concat --default tip $revargs]
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] {
- # if git-rev-parse failed for some reason...
+ # if debug-rev-parse failed for some reason...
if {$rargs == {}} {
- set revargs HEAD
+ set revargs tip
}
set parsed_args $revargs
}
@@ -220,8 +212,8 @@ proc getcommitlines {commfd} {
}
if {[string range $err 0 4] == "usage"} {
set err \
-{Gitk: error reading commits: bad arguments to git-rev-list.
-(Note: arguments to gitk are passed to git-rev-list
+{Hgk: error reading commits: bad arguments to hg debug-rev-list.
+(Note: arguments to hgk are passed to hg debug-rev-list
to allow selection of commits to be displayed.)}
} else {
set err "Error reading commits: $err"
@@ -382,8 +374,8 @@ proc parsecommit {id contents listed old
append comment "\n"
}
if {!$listed} {
- # git-rev-list indents the comment by 4 spaces;
- # if we got this via git-cat-file, add the indentation
+ # debug-rev-list indents the comment by 4 spaces;
+ # if we got this via debug-cat-file, add the indentation
append comment " "
}
append comment $line
@@ -500,8 +492,7 @@ proc readrefs {} {
proc readotherrefs {base dname excl} {
global otherrefids idotherrefs
- set git [gitdir]
- set files [glob -nocomplain -types f [file join $git $base *]]
+ set files [glob -nocomplain -types f [file join $::hgdir $base *]]
foreach f $files {
catch {
set fd [open $f r]
@@ -514,7 +505,7 @@ proc readotherrefs {base dname excl} {
close $fd
}
}
- set dirs [glob -nocomplain -types d [file join $git $base *]]
+ set dirs [glob -nocomplain -types d [file join $::hgdir $base *]]
foreach d $dirs {
set dir [file tail $d]
if {[lsearch -exact $excl $dir] >= 0} continue
@@ -2116,7 +2107,7 @@ proc readfindproc {} {
return
}
if {![regexp {^[0-9a-f]{12}} $line id]} {
- error_popup "Can't parse git-diff-tree output: $line"
+ error_popup "Can't parse debug-diff-tree output: $line"
stopfindproc
return
}
@@ -2184,7 +2175,7 @@ proc findfiles {} {
if {$l == $findstartline} break
}
- # start off a git-diff-tree process if needed
+ # start off a debug-diff-tree process if needed
if {$diffsneeded ne {}} {
if {[catch {
set df [open [list | $env(HG) --config ui.report_untrusted=false debug-diff-tree -r --stdin << $diffsneeded] r]
@@ -2246,7 +2237,7 @@ proc donefilediff {} {
if {[info exists fdiffids]} {
while {[lindex $fdiffsneeded $fdiffpos] ne $fdiffids
&& $fdiffpos < [llength $fdiffsneeded]} {
- # git-diff-tree doesn't output anything for a commit
+ # debug-diff-tree doesn't output anything for a commit
# which doesn't change anything
set nullids [lindex $fdiffsneeded $fdiffpos]
set treediffs($nullids) {}
diff --git a/hgext/hgk.py b/hgext/hgk.py
--- a/hgext/hgk.py
+++ b/hgext/hgk.py
@@ -221,7 +221,7 @@ def revtree(ui, args, repo, full="tree",
s = repo.lookup(arg[1:])
stop_sha1.append(s)
want_sha1.append(s)
- elif arg != 'HEAD':
+ elif arg != 'tip':
want_sha1.append(repo.lookup(arg))
# calculate the graph for the supplied commits
@@ -279,8 +279,6 @@ def revtree(ui, args, repo, full="tree",
def revparse(ui, repo, *revs, **opts):
"""parse given revisions"""
def revstr(rev):
- if rev == 'HEAD':
- rev = 'tip'
return revlog.hex(repo.lookup(rev))
for r in revs:
More information about the Mercurial-devel
mailing list