Mercurial > hg
changeset 7776:34ff1a1b5dd7
hgk: select first changeset at startup (issue1382)
author | Martin Geisler <mg@daimi.au.dk> |
---|---|
date | Mon, 16 Feb 2009 01:41:01 +0100 |
parents | 5280c39778b6 |
children | e3425726b80d |
files | contrib/hgk |
diffstat | 1 files changed, 28 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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 {} {