##// END OF EJS Templates
hgk: read bookmarks
David Soria Parra -
r13461:81af2040 stable
parent child Browse files
Show More
@@ -276,6 +276,7 b' proc parsecommit {id contents listed old'
276 set comdate {}
276 set comdate {}
277 set rev {}
277 set rev {}
278 set branch {}
278 set branch {}
279 set bookmark {}
279 if {![info exists nchildren($id)]} {
280 if {![info exists nchildren($id)]} {
280 set children($id) {}
281 set children($id) {}
281 set nchildren($id) 0
282 set nchildren($id) 0
@@ -314,7 +315,9 b' proc parsecommit {id contents listed old'
314 set rev [lindex $line 1]
315 set rev [lindex $line 1]
315 } elseif {$tag == "branch"} {
316 } elseif {$tag == "branch"} {
316 set branch [join [lrange $line 1 end]]
317 set branch [join [lrange $line 1 end]]
317 }
318 } elseif {$tag == "bookmark"} {
319 set bookmark [join [lrange $line 1 end]]
320 }
318 }
321 }
319 } else {
322 } else {
320 if {$comment == {}} {
323 if {$comment == {}} {
@@ -338,7 +341,7 b' proc parsecommit {id contents listed old'
338 set comdate [clock format $comdate -format "%Y-%m-%d %H:%M:%S"]
341 set comdate [clock format $comdate -format "%Y-%m-%d %H:%M:%S"]
339 }
342 }
340 set commitinfo($id) [list $headline $auname $audate \
343 set commitinfo($id) [list $headline $auname $audate \
341 $comname $comdate $comment $rev $branch]
344 $comname $comdate $comment $rev $branch $bookmark]
342
345
343 if {[info exists firstparents]} {
346 if {[info exists firstparents]} {
344 set i [lsearch $firstparents $id]
347 set i [lsearch $firstparents $id]
@@ -369,7 +372,7 b' proc parsecommit {id contents listed old'
369 }
372 }
370
373
371 proc readrefs {} {
374 proc readrefs {} {
372 global tagids idtags headids idheads tagcontents env curid
375 global bookmarkcurrent bookmarkids tagids idtags idbookmarks headids idheads tagcontents env curid
373
376
374 set status [catch {exec $env(HG) --config ui.report_untrusted=false id} curid]
377 set status [catch {exec $env(HG) --config ui.report_untrusted=false id} curid]
375 if { $status != 0 } {
378 if { $status != 0 } {
@@ -417,6 +420,28 b' proc readrefs {} {'
417 }
420 }
418 }
421 }
419
422
423 set status [catch {exec $env(HG) --config ui.report_untrusted=false bookmarks} bookmarks]
424 if { $status != 0 } {
425 puts $::errorInfo
426 if { ![string equal $::errorCode NONE] } {
427 exit 2
428 }
429 }
430 set lines [split $bookmarks "\n"]
431 set bookmarkcurrent 0
432 foreach f $lines {
433 regexp {(\S+)$} $f full
434 regsub {\s+(\S+)$} $f "" direct
435 set sha [split $full ':']
436 set bookmark [lindex $sha 1]
437 set current [string first " * " $direct)]
438 regsub {^\s(\*|\s)\s} $direct "" direct
439 lappend bookmarkids($direct) $bookmark
440 lappend idbookmarks($bookmark) $direct
441 if {$current >= 0} {
442 set bookmarkcurrent $direct
443 }
444 }
420 }
445 }
421
446
422 proc readotherrefs {base dname excl} {
447 proc readotherrefs {base dname excl} {
@@ -1042,7 +1067,7 b' proc drawcommitline {level} {'
1042 global canv canv2 canv3 mainfont namefont canvy linespc
1067 global canv canv2 canv3 mainfont namefont canvy linespc
1043 global lineid linehtag linentag linedtag commitinfo
1068 global lineid linehtag linentag linedtag commitinfo
1044 global colormap numcommits currentparents dupparents
1069 global colormap numcommits currentparents dupparents
1045 global idtags idline idheads idotherrefs
1070 global idtags idline idheads idotherrefs idbookmarks
1046 global lineno lthickness mainline mainlinearrow sidelines
1071 global lineno lthickness mainline mainlinearrow sidelines
1047 global commitlisted rowtextx idpos lastuse displist
1072 global commitlisted rowtextx idpos lastuse displist
1048 global oldnlines olddlevel olddisplist
1073 global oldnlines olddlevel olddisplist
@@ -1100,7 +1125,7 b' proc drawcommitline {level} {'
1100 set rowtextx($lineno) $xt
1125 set rowtextx($lineno) $xt
1101 set idpos($id) [list $x $xt $y1]
1126 set idpos($id) [list $x $xt $y1]
1102 if {[info exists idtags($id)] || [info exists idheads($id)]
1127 if {[info exists idtags($id)] || [info exists idheads($id)]
1103 || [info exists idotherrefs($id)]} {
1128 || [info exists idotherrefs($id)] || [info exists idbookmarks($id)]} {
1104 set xt [drawtags $id $x $xt $y1]
1129 set xt [drawtags $id $x $xt $y1]
1105 }
1130 }
1106 set headline [lindex $commitinfo($id) 0]
1131 set headline [lindex $commitinfo($id) 0]
@@ -3840,8 +3865,12 b' proc wrcomcan {} {'
3840 }
3865 }
3841
3866
3842 proc listrefs {id} {
3867 proc listrefs {id} {
3843 global idtags idheads idotherrefs
3868 global idtags idheads idotherrefs idbookmarks
3844
3869
3870 set w {}
3871 if {[info exists idbookmarks($id)]} {
3872 set w $idbookmarks($id)
3873 }
3845 set x {}
3874 set x {}
3846 if {[info exists idtags($id)]} {
3875 if {[info exists idtags($id)]} {
3847 set x $idtags($id)
3876 set x $idtags($id)
@@ -3854,26 +3883,29 b' proc listrefs {id} {'
3854 if {[info exists idotherrefs($id)]} {
3883 if {[info exists idotherrefs($id)]} {
3855 set z $idotherrefs($id)
3884 set z $idotherrefs($id)
3856 }
3885 }
3857 return [list $x $y $z]
3886 return [list $w $x $y $z]
3858 }
3887 }
3859
3888
3860 proc rereadrefs {} {
3889 proc rereadrefs {} {
3861 global idtags idheads idotherrefs
3890 global idbookmarks idtags idheads idotherrefs
3862 global tagids headids otherrefids
3891 global bookmarkids tagids headids otherrefids
3863
3892
3864 set refids [concat [array names idtags] \
3893 set refids [concat [array names idtags] \
3865 [array names idheads] [array names idotherrefs]]
3894 [array names idheads] [array names idotherrefs] \
3895 [array names idbookmarks]]
3866 foreach id $refids {
3896 foreach id $refids {
3867 if {![info exists ref($id)]} {
3897 if {![info exists ref($id)]} {
3868 set ref($id) [listrefs $id]
3898 set ref($id) [listrefs $id]
3869 }
3899 }
3870 }
3900 }
3871 foreach v {tagids idtags headids idheads otherrefids idotherrefs} {
3901 foreach v {tagids idtags headids idheads otherrefids idotherrefs \
3902 bookmarkids idbookmarks} {
3872 catch {unset $v}
3903 catch {unset $v}
3873 }
3904 }
3874 readrefs
3905 readrefs
3875 set refids [lsort -unique [concat $refids [array names idtags] \
3906 set refids [lsort -unique [concat $refids [array names idtags] \
3876 [array names idheads] [array names idotherrefs]]]
3907 [array names idheads] [array names idotherrefs] \
3908 [array names idbookmarks]]]
3877 foreach id $refids {
3909 foreach id $refids {
3878 set v [listrefs $id]
3910 set v [listrefs $id]
3879 if {![info exists ref($id)] || $ref($id) != $v} {
3911 if {![info exists ref($id)] || $ref($id) != $v} {
General Comments 0
You need to be logged in to leave comments. Login now