gitk: Update preceding/following tag info when creating a tag
Signed-off-by: Paul Mackerras <paulus@samba.org>
Paul Mackerras committed
Aug 8, 2006 at 20:55 UTC
ceadfe90c64b293a653bcbbce83283d2665d7cf9
1 file changed
+77
gitk
+77
@@ -5062,6 +5062,7 @@ proc domktag {} {
5062
set tagids($tag) $id
5063
lappend idtags($id) $tag
5064
redrawtags $id
5065
+ addedtag $id
5066
}
5067
5068
proc redrawtags {id} {
@@ -5505,6 +5506,82 @@ proc restartatags {} {
5506
dispneartags
5507
}
5508
5509
+# update the desc_tags and anc_tags arrays for a new tag just added
5510
+proc addedtag {id} {
5511
+ global desc_tags anc_tags allparents allchildren allcommits
5512
+ global idtags tagisdesc alldtags
5513
+
5514
+ if {![info exists desc_tags($id)]} return
5515
+ set adt $desc_tags($id)
5516
+ foreach t $desc_tags($id) {
5517
+ set adt [concat $adt $alldtags($t)]
5518
+ }
5519
+ set adt [lsort -unique $adt]
5520
+ set alldtags($id) $adt
5521
+ foreach t $adt {
5522
+ set tagisdesc($id,$t) -1
5523
+ set tagisdesc($t,$id) 1
5524
+ }
5525
+ if {[info exists anc_tags($id)]} {
5526
+ set todo $anc_tags($id)
5527
+ while {$todo ne {}} {
5528
+ set do [lindex $todo 0]
5529
+ set todo [lrange $todo 1 end]
5530
+ if {[info exists tagisdesc($id,$do)]} continue
5531
+ set tagisdesc($do,$id) -1
5532
+ set tagisdesc($id,$do) 1
5533
+ if {[info exists anc_tags($do)]} {
5534
+ set todo [concat $todo $anc_tags($do)]
5535
+ }
5536
+ }
5537
+ }
5538
+
5539
+ set lastold $desc_tags($id)
5540
+ set lastnew [list $id]
5541
+ set nup 0
5542
+ set nch 0
5543
+ set todo $allparents($id)
5544
+ while {$todo ne {}} {
5545
+ set do [lindex $todo 0]
5546
+ set todo [lrange $todo 1 end]
5547
+ if {![info exists desc_tags($do)]} continue
5548
+ if {$desc_tags($do) ne $lastold} {
5549
+ set lastold $desc_tags($do)
5550
+ set lastnew [combine_dtags $lastold [list $id]]
5551
+ incr nch
5552
+ }
5553
+ if {$lastold eq $lastnew} continue
5554
+ set desc_tags($do) $lastnew
5555
+ incr nup
5556
+ if {![info exists idtags($do)]} {
5557
+ set todo [concat $todo $allparents($do)]
5558
+ }
5559
+ }
5560
+
5561
+ if {![info exists anc_tags($id)]} return
5562
+ set lastold $anc_tags($id)
5563
+ set lastnew [list $id]
5564
+ set nup 0
5565
+ set nch 0
5566
+ set todo $allchildren($id)
5567
+ while {$todo ne {}} {
5568
+ set do [lindex $todo 0]
5569
+ set todo [lrange $todo 1 end]
5570
+ if {![info exists anc_tags($do)]} continue
5571
+ if {$anc_tags($do) ne $lastold} {
5572
+ set lastold $anc_tags($do)
5573
+ set lastnew [combine_atags $lastold [list $id]]
5574
+ incr nch
5575
+ }
5576
+ if {$lastold eq $lastnew} continue
5577
+ set anc_tags($do) $lastnew
5578
+ incr nup
5579
+ if {![info exists idtags($do)]} {
5580
+ set todo [concat $todo $allchildren($do)]
5581
+ }
5582
+ }
5583
+}
5584
+
5585
# update the desc_heads array for a new head just added
5586
proc addedhead {hid head} {
5587
global desc_heads allparents headids idheads