Fossil SCM
Implemented time ranges and dependency retrieval for the tag and branch based changesets.
Commit
b1666f8ff4a2c16d8a9531697d438ce8720d20ac
Parent
70d22835649e2e4…
1 file changed
+124
| --- tools/cvs2fossil/lib/c2f_prev.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_prev.tcl | ||
| @@ -908,18 +908,64 @@ | ||
| 908 | 908 | typemethod istag {} { return 1 } |
| 909 | 909 | typemethod isbranch {} { return 0 } |
| 910 | 910 | |
| 911 | 911 | # result = list (mintime, maxtime) |
| 912 | 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 | + "] | |
| 913 | 923 | } |
| 914 | 924 | |
| 915 | 925 | # var(dv) = dict (item -> list (item)), item = list (type id) |
| 916 | 926 | typemethod successors {dv tags} { |
| 927 | + # Tags have no successors. | |
| 928 | + return | |
| 917 | 929 | } |
| 918 | 930 | |
| 919 | 931 | # var(dv) = dict (item -> list (item)), item = list (type id) |
| 920 | 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 | |
| 921 | 967 | } |
| 922 | 968 | } |
| 923 | 969 | |
| 924 | 970 | # # ## ### ##### ######## ############# ##################### |
| 925 | 971 | ## Helper singleton. Commands for branch symbol changesets. |
| @@ -930,18 +976,96 @@ | ||
| 930 | 976 | typemethod istag {} { return 0 } |
| 931 | 977 | typemethod isbranch {} { return 1 } |
| 932 | 978 | |
| 933 | 979 | # result = list (mintime, maxtime) |
| 934 | 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 | + "] | |
| 935 | 995 | } |
| 936 | 996 | |
| 937 | 997 | # var(dv) = dict (item -> list (item)), item = list (type id) |
| 938 | 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 | |
| 939 | 1031 | } |
| 940 | 1032 | |
| 941 | 1033 | # var(dv) = dict (item -> list (item)), item = list (type id) |
| 942 | 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 | |
| 943 | 1067 | } |
| 944 | 1068 | |
| 945 | 1069 | # # ## ### ##### ######## ############# |
| 946 | 1070 | ## Configuration |
| 947 | 1071 | |
| 948 | 1072 |
| --- 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 |