568
}
569
570
proc insertrow {id p v} {
571
+ global cmitlisted children parents varcid varctok vtokmod
572
+ global varccommits ordertok commitidx numcommits curview
573
+ global targetid targetrow
574
+
575
+ readcommit $id
576
+ set vid $v,$id
577
+ set cmitlisted($vid) 1
578
+ set children($vid) {}
579
+ set parents($vid) [list $p]
580
+ set a [newvarc $v $id]
581
+ set varcid($vid) $a
582
+ if {[string compare [lindex $varctok($v) $a] $vtokmod($v)] < 0} {
583
+ modify_arc $v $a
584
+ }
585
+ lappend varccommits($v,$a) $id
586
+ set vp $v,$p
587
+ if {[llength [lappend children($vp) $id]] > 1} {
588
+ set children($vp) [lsort -command [list vtokcmp $v] $children($vp)]
589
+ catch {unset ordertok}
590
+ }
591
+ fix_reversal $p $a $v
592
+ incr commitidx($v)
593
+ if {$v == $curview} {
594
+ set numcommits $commitidx($v)
595
+ setcanvscroll
596
+ if {[info exists targetid]} {
597
+ if {![comes_before $targetid $p]} {
598
+ incr targetrow
599
+ }
600
+ }
601
+ }
602
+}
603
+
604
+proc insertfakerow {id p} {
605
global varcid varccommits parents children cmitlisted
572
- global commitidx varctok vtokmod targetid targetrow
606
+ global commitidx varctok vtokmod targetid targetrow curview numcommits
607
608
+ set v $curview
609
set a $varcid($v,$p)
610
set i [lsearch -exact $varccommits($v,$a) $p]
611
if {$i < 0} {
577
- puts "oops: insertrow can't find [shortids $p] on arc $a"
612
+ puts "oops: insertfakerow can't find [shortids $p] on arc $a"
613
return
614
}
615
set children($v,$id) {}
617
set varcid($v,$id) $a
618
lappend children($v,$p) $id
619
set cmitlisted($v,$id) 1
585
- incr commitidx($v)
620
+ set numcommits [incr commitidx($v)]
621
# note we deliberately don't update varcstart($v) even if $i == 0
622
set varccommits($v,$a) [linsert $varccommits($v,$a) $i $id]
623
if {[string compare [lindex $varctok($v) $a] $vtokmod($v)] < 0} {
628
incr targetrow
629
}
630
}
631
+ setcanvscroll
632
drawvisible
633
}
634
599
-proc removerow {id v} {
635
+proc removefakerow {id} {
636
global varcid varccommits parents children commitidx
637
global varctok vtokmod cmitlisted currentid selectedline
602
- global targetid
638
+ global targetid curview numcommits
639
640
+ set v $curview
641
if {[llength $parents($v,$id)] != 1} {
605
- puts "oops: removerow [shortids $id] has [llength $parents($v,$id)] parents"
642
+ puts "oops: removefakerow [shortids $id] has [llength $parents($v,$id)] parents"
643
return
644
}
645
set p [lindex $parents($v,$id) 0]
646
set a $varcid($v,$id)
647
set i [lsearch -exact $varccommits($v,$a) $id]
648
if {$i < 0} {
612
- puts "oops: removerow can't find [shortids $id] on arc $a"
649
+ puts "oops: removefakerow can't find [shortids $id] on arc $a"
650
return
651
}
652
unset varcid($v,$id)
654
unset parents($v,$id)
655
unset children($v,$id)
656
unset cmitlisted($v,$id)
620
- incr commitidx($v) -1
657
+ set numcommits [incr commitidx($v) -1]
658
set j [lsearch -exact $children($v,$p) $id]
659
if {$j >= 0} {
660
set children($v,$p) [lreplace $children($v,$p) $j $j]
669
if {[info exists targetid] && $targetid eq $id} {
670
set targetid $p
671
}
672
+ setcanvscroll
673
drawvisible
674
}
675
3572
global nullid nullid2 lserial curview
3573
3574
if {[commitinview $nullid $curview]} {
3537
- removerow $nullid $curview
3575
+ removefakerow $nullid
3576
}
3577
if {[commitinview $nullid2 $curview]} {
3540
- removerow $nullid2 $curview
3578
+ removefakerow $nullid2
3579
}
3580
incr lserial
3581
}
3619
set commitinfo($nullid2) [list $hl {} {} {} {} " $hl\n"]
3620
set commitdata($nullid2) "\n $hl\n"
3621
if {[commitinview $nullid $curview]} {
3584
- removerow $nullid $curview
3622
+ removefakerow $nullid
3623
}
3586
- insertrow $nullid2 $mainheadid $curview
3624
+ insertfakerow $nullid2 $mainheadid
3625
} elseif {!$isdiff && [commitinview $nullid2 $curview]} {
3588
- removerow $nullid2 $curview
3626
+ removefakerow $nullid2
3627
}
3628
return 0
3629
}
3656
} else {
3657
set p $mainheadid
3658
}
3621
- insertrow $nullid $p $curview
3659
+ insertfakerow $nullid $p
3660
} elseif {!$isdiff && [commitinview $nullid $curview]} {
3623
- removerow $nullid $curview
3661
+ removefakerow $nullid
3662
}
3663
return 0
3664
}
5385
global commentend idtags linknum
5386
global mergemax numcommits pending_select
5387
global cmitmode showneartags allcommits
5388
+ global targetrow targetid
5389
5390
catch {unset pending_select}
5391
$canv delete hover
5438
5439
set selectedline $l
5440
set currentid $id
5441
+ set targetid $id
5442
+ set targetrow $l
5443
$sha1entry delete 0 end
5444
$sha1entry insert 0 $id
5445
$sha1entry selection from 0
7036
7037
proc cherrypick {} {
7038
global rowmenuid curview
6998
- global mainhead
7039
+ global mainhead mainheadid
7040
7041
set oldhead [exec git rev-parse HEAD]
7042
set dheads [descheads $rowmenuid]
7067
if {$mainhead ne {}} {
7068
movehead $newhead $mainhead
7069
movedhead $newhead $mainhead
7070
+ set mainheadid $newhead
7071
}
7072
redrawtags $oldhead
7073
redrawtags $newhead
7077
}
7078
7079
proc resethead {} {
7038
- global mainheadid mainhead rowmenuid confirm_ok resettype
7080
+ global mainhead rowmenuid confirm_ok resettype
7081
7082
set confirm_ok 0
7083
set w ".confirmreset"