Fossil

Check-in [b1666f8f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Implemented time ranges and dependency retrieval for the tag and branch based changesets.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:b1666f8ff4a2c16d8a9531697d438ce8720d20ac
User & Date: aku 2007-11-29 07:02:39
Context
2007-11-29
07:24
Reworked the in-memory databases of changesets. Objects now hold items, not only revisions. Tags, and branches are new possibilities. Lists of ids go to the type-dependent retrieval command. List of tagged items (type/id pairs) come back, and are in the API. The 1:n map revisions to changesets is now an 1:1-map tagged items to changeset. check-in: 0fcfbf78 user: aku tags: trunk
07:02
Implemented time ranges and dependency retrieval for the tag and branch based changesets. check-in: b1666f8f user: aku tags: trunk
06:58
Moved the existing successor/predecessor code from main class to the proper singleton. Fixed config of main class, isn't simple dispatch any longer. Simplified calculation of the readable representation of changesets and removed code which has become superfluous. check-in: 70d22835 user: aku tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to tools/cvs2fossil/lib/c2f_prev.tcl.

   906    906       typemethod byrevision {} { return 0 }
   907    907       typemethod bysymbol   {} { return 1 }
   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.
   926    972   
   927    973   snit::type ::vc::fossil::import::cvs::project::rev::sym::branch {
................................................................................
   928    974       typemethod byrevision {} { return 0 }
   929    975       typemethod bysymbol   {} { return 1 }
   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       pragma -hasinstances   no ; # singleton
   949   1073       pragma -hastypeinfo    no ; # no introspection