49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
+
+
+
+
+
+
+
+
+
+
|
# eskil::rev::XXX::getPatch {revs}
#
# Get a patch of the file tree, between the revisions given.
# revs is in any format understood by this system, and
# should be retrieved from ParseRevs
# eskil::rev::XXX::commitFile {top filename}
#
# If implemented, enables the commit feature when comparing an edited
# file agains latest check in.
# eskil::rev::XXX::viewLog {top filename revs}
#
# If implemented, enables the log feature when comparing revisions.
# View log between displayed versions
namespace eval eskil::rev::CVS {}
namespace eval eskil::rev::RCS {}
namespace eval eskil::rev::CT {}
namespace eval eskil::rev::GIT {}
namespace eval eskil::rev::SVN {}
namespace eval eskil::rev::HG {}
namespace eval eskil::rev::BZR {}
|
603
604
605
606
607
608
609
610
611
612
613
614
615
616
|
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
# Check in CVS controlled file
proc eskil::rev::CVS::commitFile {top filename} {
set logmsg [LogDialog $top $filename]
if {$logmsg ne ""} {
catch {exec cvs -q commit -m $logmsg $filename}
}
}
# Check in SVN controlled file
proc eskil::rev::SVN::commitFile {top filename} {
set logmsg [LogDialog $top $filename]
if {$logmsg ne ""} {
catch {exec svn -q commit -m $logmsg $filename}
}
}
# View log between displayed versions
proc eskil::rev::CVS::viewLog {top filename revs} {
set cmd [list exec cvs -q log -N]
if {[llength $revs] > 1} {
lappend cmd -r[join $revs ":"]
} else {
lappend cmd -r[lindex $revs 0]:
}
lappend cmd $filename
if {[catch {eval $cmd} result]} {
#return
}
ViewLog $top $filename $result
}
# View log between displayed versions
proc eskil::rev::SVN::viewLog {top filename revs} {
set cmd [list exec svn log]
if {[llength $revs] > 1} {
lappend cmd -r [join $revs ":"]
} else {
lappend cmd -r HEAD:[lindex $revs 0]
}
lappend cmd $filename
if {[catch {eval $cmd} result]} {
#return
}
ViewLog $top $filename $result
}
proc eskil::rev::CT::current {filename} {
# Figure out stream and current version
if {[catch {exec cleartool ls $filename} info]} {
tk_messageBox -icon error -title "Cleartool error" -message $info
return
}
|
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
|
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
|
+
+
-
-
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
|
}
# Prepare for RCS/CVS/CT diff. Checkout copies of the versions needed.
proc prepareRev {top} {
global Pref
$::widgets($top,commit) configure -state disabled
$::widgets($top,log) configure -state disabled
set type $::diff($top,modetype)
set revs {}
# Search for revision options
if {$::diff($top,doptrev1) != ""} {
lappend revs $::diff($top,doptrev1)
}
if {$::diff($top,doptrev2) != ""} {
lappend revs $::diff($top,doptrev2)
}
set revs [eskil::rev::${type}::ParseRevs $::diff($top,RevFile) $revs]
set revlabels {}
foreach rev $revs {
lappend revlabels [GetLastTwoPath $rev]
}
set ::diff($top,RevRevs) $revs
if {[llength $revs] < 2} {
# Compare local file with specified version.
disallowEdit $top 1
if {[llength $revs] == 0} {
set r ""
set tag "($type)"
} else {
set r [lindex $revs 0]
set tag "($type [lindex $revlabels 0])"
}
set ::diff($top,leftFile) [tmpFile]
set ::diff($top,leftLabel) "$::diff($top,RevFile) $tag"
set ::diff($top,rightLabel) $::diff($top,RevFile)
set ::diff($top,rightFile) $::diff($top,RevFile)
eskil::rev::${type}::get $::diff($top,RevFile) $::diff($top,leftFile) $r
if {$type eq "CVS" && [llength $revs] == 0} {
$::widgets($top,commit) configure -state normal
if {[llength $revs] == 0} {
if {[info commands eskil::rev::${type}::commitFile] ne ""} {
$::widgets($top,commit) configure -state normal
}
}
} else {
# Compare the two specified versions.
disallowEdit $top
set r1 [lindex $revs 0]
set r2 [lindex $revs 1]
set ::diff($top,leftFile) [tmpFile]
set ::diff($top,rightFile) [tmpFile]
set ::diff($top,leftLabel) \
"$::diff($top,RevFile) ($type [lindex $revlabels 0])"
set ::diff($top,rightLabel) \
"$::diff($top,RevFile) ($type [lindex $revlabels 1])"
eskil::rev::${type}::get $::diff($top,RevFile) $::diff($top,leftFile) $r1
eskil::rev::${type}::get $::diff($top,RevFile) $::diff($top,rightFile) $r2
}
if {[llength $revs] > 0} {
if {[info commands eskil::rev::${type}::viewLog] ne ""} {
$::widgets($top,log) configure -state normal
}
}
# Make sure labels are updated before processing starts
update idletasks
}
# Clean up after a RCS/CVS/CT diff.
proc cleanupRev {top} {
global Pref
clearTmp $::diff($top,rightFile) $::diff($top,leftFile)
set ::diff($top,rightFile) $::diff($top,RevFile)
set ::diff($top,leftFile) $::diff($top,RevFile)
}
proc revCommit {top} {
if {[$::widgets($top,commit) cget -state] eq "disabled"} return
set type $::diff($top,modetype)
eskil::rev::CVS::commitFile $top $::diff($top,RevFile)
eskil::rev::${type}::commitFile $top $::diff($top,RevFile)
}
proc revLog {top} {
if {[$::widgets($top,log) cget -state] eq "disabled"} return
set type $::diff($top,modetype)
eskil::rev::${type}::viewLog $top $::diff($top,RevFile) \
$::diff($top,RevRevs)
}
# Get a complete tree patch from this system.
proc getFullPatch {top} {
global Pref
set type $::diff($top,modetype)
|
824
825
826
827
828
829
830
|
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
set res "No Log"
}
} else {
set res ""
}
return $res
}
# Dialog for log view
proc ViewLog {top filename message} {
set w $top.logview
destroy $w
toplevel $w -padx 3 -pady 3
wm title $w "Log for [file tail $filename]"
text $w.t -width 80 -height 15 -yscrollcommand "$w.sby set" -wrap none
scrollbar $w.sby -orient vertical -command "$w.t yview"
$w.t insert end $message
ttk::button $w.ok -width 10 -text "Dismiss" -command "destroy $w" \
-underline 0
bind $w <Alt-d> [list destroy $w]\;break
bind $w <Key-Escape> [list destroy $w]\;break
grid $w.t $w.sby -sticky news -padx 3 -pady 3
grid $w.ok - -padx 3 -pady 3
grid columnconfigure $w 0 -weight 1
grid rowconfigure $w 0 -weight 1
}
|