hgk: select first changeset at startup (
issue1382)
--- a/contrib/hgk Mon Feb 16 00:09:47 2009 +0100
+++ b/contrib/hgk Mon Feb 16 01:41:01 2009 +0100
@@ -265,6 +265,7 @@
proc parsecommit {id contents listed olds} {
global commitinfo children nchildren parents nparents cdate ncleft
+ global firstparents
set inhdr 1
set comment {}
@@ -338,6 +339,33 @@
}
set commitinfo($id) [list $headline $auname $audate \
$comname $comdate $comment $rev $branch]
+
+ if {[info exists firstparents]} {
+ set i [lsearch $firstparents $id]
+ if {$i != -1} {
+ # remove the parent from firstparents, possible building
+ # an empty list
+ set firstparents [concat \
+ [lrange $firstparents 0 [expr $i - 1]] \
+ [lrange $firstparents [expr $i + 1] end]]
+ if {$firstparents eq {}} {
+ # we have found all parents of the first changeset
+ # which means that we can safely select the first line
+ after idle {
+ selectline 0 0
+ }
+ }
+ }
+ } else {
+ # this is the first changeset, save the parents
+ set firstparents $olds
+ if {$firstparents eq {}} {
+ # a repository with a single changeset
+ after idle {
+ selectline 0 0
+ }
+ }
+ }
}
proc readrefs {} {