Fossil SCM

Implemented time ranges and dependency retrieval for the tag and branch based changesets.

aku 2007-11-29 07:02 trunk
Commit b1666f8ff4a2c16d8a9531697d438ce8720d20ac
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -908,18 +908,64 @@
908908
typemethod istag {} { return 1 }
909909
typemethod isbranch {} { return 0 }
910910
911911
# result = list (mintime, maxtime)
912912
typemethod timerange {tags} {
913
+ # The range is defined as the range of the revisions the tags
914
+ # are attached to.
915
+
916
+ set theset ('[join $tags {','}]')
917
+ return [state run "
918
+ SELECT MIN(R.date), MAX(R.date)
919
+ FROM revision R, tag T
920
+ WHERE T.tid IN $theset
921
+ AND R.rid = T.rev
922
+ "]
913923
}
914924
915925
# var(dv) = dict (item -> list (item)), item = list (type id)
916926
typemethod successors {dv tags} {
927
+ # Tags have no successors.
928
+ return
917929
}
918930
919931
# var(dv) = dict (item -> list (item)), item = list (type id)
920932
typemethod predecessors {dv tags} {
933
+ # The predecessors of a tag are all the revisions the tags are
934
+ # attached to, as well as all the branches or tags which are
935
+ # their prefered parents.
936
+
937
+ set theset ('[join $tags {','}]')
938
+ foreach {tid parent} [state run "
939
+ SELECT T.tid, R.rid
940
+ FROM revision R, tag T
941
+ WHERE T.tid IN $theset
942
+ AND T.rev = R.rid
943
+ "] {
944
+ lappend dependencies([list sym::tag $tid]) [list rev $parent]
945
+ }
946
+
947
+ foreach {tid parent} [state run "
948
+ SELECT T.tid, B.bid
949
+ FROM tag T, branch B, preferedparent P
950
+ WHERE T.tid IN $theset
951
+ AND T.sid = P.sid
952
+ AND P.pid = B.sid
953
+ "] {
954
+ lappend dependencies([list sym::tag $tid]) [list sym::branch $parent]
955
+ }
956
+
957
+ foreach {tid parent} [state run "
958
+ SELECT T.tid, TX.tid
959
+ FROM tag T, tag TX, preferedparent P
960
+ WHERE T.tid IN $theset
961
+ AND T.sid = P.sid
962
+ AND P.pid = TX.sid
963
+ "] {
964
+ lappend dependencies([list sym::tag $tid]) [list sym::tag $parent]
965
+ }
966
+ return
921967
}
922968
}
923969
924970
# # ## ### ##### ######## ############# #####################
925971
## Helper singleton. Commands for branch symbol changesets.
@@ -930,18 +976,96 @@
930976
typemethod istag {} { return 0 }
931977
typemethod isbranch {} { return 1 }
932978
933979
# result = list (mintime, maxtime)
934980
typemethod timerange {branches} {
981
+ # The range of a branch is defined as the range of the
982
+ # revisions the branches are spawned by. NOTE however that the
983
+ # branches associated with a detached NTDB will have no root
984
+ # spawning them, hence they have no real timerange any
985
+ # longer. By using 0 we put them in front of everything else,
986
+ # as they logically are.
987
+
988
+ set theset ('[join $branches {','}]')
989
+ return [state run "
990
+ SELECT IFNULL(MIN(R.date),0), IFNULL(MAX(R.date),0)
991
+ FROM revision R, branch B
992
+ WHERE B.bid IN $theset
993
+ AND R.rid = B.root
994
+ "]
935995
}
936996
937997
# var(dv) = dict (item -> list (item)), item = list (type id)
938998
typemethod successors {dv branches} {
999
+ # The first revision committed on a branch, and all branches
1000
+ # and tags which have it as their prefered parent are the
1001
+ # successors of a branch.
1002
+
1003
+ set theset ('[join $branches {','}]')
1004
+ foreach {bid child} [state run "
1005
+ SELECT B.bid, R.rid
1006
+ FROM revision R, branch B
1007
+ WHERE B.bid IN $theset
1008
+ AND B.first = R.rid
1009
+ "] {
1010
+ lappend dependencies([list sym::tag $bid]) [list rev $child]
1011
+ }
1012
+ foreach {bid child} [state run "
1013
+ SELECT B.bid, BX.bid
1014
+ FROM branch B, branch BX, preferedparent P
1015
+ WHERE B.bid IN $theset
1016
+ AND B.sid = P.pid
1017
+ AND BX.sid = P.sid
1018
+ "] {
1019
+ lappend dependencies([list sym::tag $bid]) [list sym::branch $child]
1020
+ }
1021
+ foreach {bid child} [state run "
1022
+ SELECT B.bid, T.tid
1023
+ FROM branch B, tag T, preferedparent P
1024
+ WHERE B.bid IN $theset
1025
+ AND B.sid = P.pid
1026
+ AND T.sid = P.sid
1027
+ "] {
1028
+ lappend dependencies([list sym::tag $bid]) [list sym::tag $child]
1029
+ }
1030
+ return
9391031
}
9401032
9411033
# var(dv) = dict (item -> list (item)), item = list (type id)
9421034
typemethod predecessors {dv branches} {
1035
+ # The predecessors of a branch are all the revisions the
1036
+ # branches are spawned from, as well as all the branches or
1037
+ # tags which are their prefered parents.
1038
+
1039
+ set theset ('[join $tags {','}]')
1040
+ foreach {bid parent} [state run "
1041
+ SELECT B.Bid, R.rid
1042
+ FROM revision R, branch B
1043
+ WHERE B.bid IN $theset
1044
+ AND B.root = R.rid
1045
+ "] {
1046
+ lappend dependencies([list sym::branch $bid]) [list rev $parent]
1047
+ }
1048
+ foreach {bid parent} [state run "
1049
+ SELECT B.bid, BX.bid
1050
+ FROM branch B, branch BX, preferedparent P
1051
+ WHERE B.bid IN $theset
1052
+ AND B.sid = P.sid
1053
+ AND P.pid = BX.sid
1054
+ "] {
1055
+ lappend dependencies([list sym::branch $bid]) [list sym::branch $parent]
1056
+ }
1057
+ foreach {bid parent} [state run "
1058
+ SELECT B.bid, T.tid
1059
+ FROM branch B, tag T, preferedparent P
1060
+ WHERE B.tid IN $theset
1061
+ AND B.sid = P.sid
1062
+ AND P.pid = T.sid
1063
+ "] {
1064
+ lappend dependencies([list sym::branch $bid]) [list sym::tag $parent]
1065
+ }
1066
+ return
9431067
}
9441068
9451069
# # ## ### ##### ######## #############
9461070
## Configuration
9471071
9481072
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -908,18 +908,64 @@
908 typemethod istag {} { return 1 }
909 typemethod isbranch {} { return 0 }
910
911 # result = list (mintime, maxtime)
912 typemethod timerange {tags} {
 
 
 
 
 
 
 
 
 
 
913 }
914
915 # var(dv) = dict (item -> list (item)), item = list (type id)
916 typemethod successors {dv tags} {
 
 
917 }
918
919 # var(dv) = dict (item -> list (item)), item = list (type id)
920 typemethod predecessors {dv tags} {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
921 }
922 }
923
924 # # ## ### ##### ######## ############# #####################
925 ## Helper singleton. Commands for branch symbol changesets.
@@ -930,18 +976,96 @@
930 typemethod istag {} { return 0 }
931 typemethod isbranch {} { return 1 }
932
933 # result = list (mintime, maxtime)
934 typemethod timerange {branches} {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
935 }
936
937 # var(dv) = dict (item -> list (item)), item = list (type id)
938 typemethod successors {dv branches} {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
939 }
940
941 # var(dv) = dict (item -> list (item)), item = list (type id)
942 typemethod predecessors {dv branches} {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
943 }
944
945 # # ## ### ##### ######## #############
946 ## Configuration
947
948
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -908,18 +908,64 @@
908 typemethod istag {} { return 1 }
909 typemethod isbranch {} { return 0 }
910
911 # result = list (mintime, maxtime)
912 typemethod timerange {tags} {
913 # The range is defined as the range of the revisions the tags
914 # are attached to.
915
916 set theset ('[join $tags {','}]')
917 return [state run "
918 SELECT MIN(R.date), MAX(R.date)
919 FROM revision R, tag T
920 WHERE T.tid IN $theset
921 AND R.rid = T.rev
922 "]
923 }
924
925 # var(dv) = dict (item -> list (item)), item = list (type id)
926 typemethod successors {dv tags} {
927 # Tags have no successors.
928 return
929 }
930
931 # var(dv) = dict (item -> list (item)), item = list (type id)
932 typemethod predecessors {dv tags} {
933 # The predecessors of a tag are all the revisions the tags are
934 # attached to, as well as all the branches or tags which are
935 # their prefered parents.
936
937 set theset ('[join $tags {','}]')
938 foreach {tid parent} [state run "
939 SELECT T.tid, R.rid
940 FROM revision R, tag T
941 WHERE T.tid IN $theset
942 AND T.rev = R.rid
943 "] {
944 lappend dependencies([list sym::tag $tid]) [list rev $parent]
945 }
946
947 foreach {tid parent} [state run "
948 SELECT T.tid, B.bid
949 FROM tag T, branch B, preferedparent P
950 WHERE T.tid IN $theset
951 AND T.sid = P.sid
952 AND P.pid = B.sid
953 "] {
954 lappend dependencies([list sym::tag $tid]) [list sym::branch $parent]
955 }
956
957 foreach {tid parent} [state run "
958 SELECT T.tid, TX.tid
959 FROM tag T, tag TX, preferedparent P
960 WHERE T.tid IN $theset
961 AND T.sid = P.sid
962 AND P.pid = TX.sid
963 "] {
964 lappend dependencies([list sym::tag $tid]) [list sym::tag $parent]
965 }
966 return
967 }
968 }
969
970 # # ## ### ##### ######## ############# #####################
971 ## Helper singleton. Commands for branch symbol changesets.
@@ -930,18 +976,96 @@
976 typemethod istag {} { return 0 }
977 typemethod isbranch {} { return 1 }
978
979 # result = list (mintime, maxtime)
980 typemethod timerange {branches} {
981 # The range of a branch is defined as the range of the
982 # revisions the branches are spawned by. NOTE however that the
983 # branches associated with a detached NTDB will have no root
984 # spawning them, hence they have no real timerange any
985 # longer. By using 0 we put them in front of everything else,
986 # as they logically are.
987
988 set theset ('[join $branches {','}]')
989 return [state run "
990 SELECT IFNULL(MIN(R.date),0), IFNULL(MAX(R.date),0)
991 FROM revision R, branch B
992 WHERE B.bid IN $theset
993 AND R.rid = B.root
994 "]
995 }
996
997 # var(dv) = dict (item -> list (item)), item = list (type id)
998 typemethod successors {dv branches} {
999 # The first revision committed on a branch, and all branches
1000 # and tags which have it as their prefered parent are the
1001 # successors of a branch.
1002
1003 set theset ('[join $branches {','}]')
1004 foreach {bid child} [state run "
1005 SELECT B.bid, R.rid
1006 FROM revision R, branch B
1007 WHERE B.bid IN $theset
1008 AND B.first = R.rid
1009 "] {
1010 lappend dependencies([list sym::tag $bid]) [list rev $child]
1011 }
1012 foreach {bid child} [state run "
1013 SELECT B.bid, BX.bid
1014 FROM branch B, branch BX, preferedparent P
1015 WHERE B.bid IN $theset
1016 AND B.sid = P.pid
1017 AND BX.sid = P.sid
1018 "] {
1019 lappend dependencies([list sym::tag $bid]) [list sym::branch $child]
1020 }
1021 foreach {bid child} [state run "
1022 SELECT B.bid, T.tid
1023 FROM branch B, tag T, preferedparent P
1024 WHERE B.bid IN $theset
1025 AND B.sid = P.pid
1026 AND T.sid = P.sid
1027 "] {
1028 lappend dependencies([list sym::tag $bid]) [list sym::tag $child]
1029 }
1030 return
1031 }
1032
1033 # var(dv) = dict (item -> list (item)), item = list (type id)
1034 typemethod predecessors {dv branches} {
1035 # The predecessors of a branch are all the revisions the
1036 # branches are spawned from, as well as all the branches or
1037 # tags which are their prefered parents.
1038
1039 set theset ('[join $tags {','}]')
1040 foreach {bid parent} [state run "
1041 SELECT B.Bid, R.rid
1042 FROM revision R, branch B
1043 WHERE B.bid IN $theset
1044 AND B.root = R.rid
1045 "] {
1046 lappend dependencies([list sym::branch $bid]) [list rev $parent]
1047 }
1048 foreach {bid parent} [state run "
1049 SELECT B.bid, BX.bid
1050 FROM branch B, branch BX, preferedparent P
1051 WHERE B.bid IN $theset
1052 AND B.sid = P.sid
1053 AND P.pid = BX.sid
1054 "] {
1055 lappend dependencies([list sym::branch $bid]) [list sym::branch $parent]
1056 }
1057 foreach {bid parent} [state run "
1058 SELECT B.bid, T.tid
1059 FROM branch B, tag T, preferedparent P
1060 WHERE B.tid IN $theset
1061 AND B.sid = P.sid
1062 AND P.pid = T.sid
1063 "] {
1064 lappend dependencies([list sym::branch $bid]) [list sym::tag $parent]
1065 }
1066 return
1067 }
1068
1069 # # ## ### ##### ######## #############
1070 ## Configuration
1071
1072

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button