# HG changeset patch # User Martin Geisler # Date 1234744861 -3600 # Node ID 34ff1a1b5dd741ccb03240d485ae548b3528ec0a # Parent 5280c39778b65641e8613b8f9f8dd2a7bfbf9240 hgk: select first changeset at startup (issue1382) diff -r 5280c39778b6 -r 34ff1a1b5dd7 contrib/hgk --- 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 {} {