Diff
Not logged in

Differences From:

File tools/cvs2fossil/lib/c2f_frev.tcl part of check-in [67c24820c7] - Reworked the whole handling of meta data (author, commit message, plus project/branch information), so that revisions now store only the meta id, everything else is stored centrally. All the relevant pieces (author, cmessage, symbols, projects) now also get numeric ids assigned early instead of when being saved to the state. Project ids are loaded from the state now too. by aku on 2007-10-14 01:58:07. [view]

To:

File tools/cvs2fossil/lib/c2f_frev.tcl part of check-in [e5441b908d] - Continued work on pass II, starting to post-process tags, branches, and revisions, cleaning up cvs quirks, determining higher-level aggregates ... by aku on 2007-10-15 00:03:30. [view]

@@ -38,10 +38,13 @@
 
     method hasmeta {}     { return [expr {$mymetaid ne ""}] }
     method setmeta {meta} { set mymetaid $meta ; return }
     method settext {text} { set mytext   $text ; return }
+    method setlod  {lod}  { set mylod    $lod  ; return }
 
     method revnr {} { return $myrevnr }
+    method state {} { return $mystate }
+    method lod   {} { return $mylod   }
 
     # Basic parent/child linkage __________
 
     method hasparent {} { return [expr {$myparent ne ""}] }
@@ -113,8 +116,23 @@
 	}
 	return
     }
 
+    method determineoperation {} {
+	# Look at the state of both this revision and its parent to
+	# determine the type opf operation which was performed (add,
+	# modify, delete, none).
+	#
+	# The important information is dead vs not-dead for both,
+	# giving rise to four possible types.
+
+	set sdead [expr {$mystate eq "dead"}]
+	set pdead [expr {$myparent eq "" || [$myparent state] eq "dead"}]
+
+	set myoperation $myopstate([list $pdead $sdead])
+	return
+    }
+
     # # ## ### ##### ######## #############
     ## Type API
 
     typemethod istrunkrevnr {revnr} {
@@ -161,9 +179,8 @@
     variable myorigdate  {} ; # Original unmodified timestamp.
     variable mystate     {} ; # State of the revision.
     variable myfile      {} ; # Ref to the file object the revision belongs to.
     variable mytext      {} ; # Range of the (delta) text for this revision in the file.
-
     variable mymetaid    {} ; # Id of the meta data group the revision
 			      # belongs to. This is later used to put
 			      # the file revisions into preliminary
 			      # changesets (aka project revisions).
@@ -171,8 +188,14 @@
 			      # namely: the project and branch the
 			      # revision was committed to, the author
 			      # who did the commit, and the message
 			      # used.
+    variable mylod       {} ; # Reference to the line-of-development
+			      # object the revision belongs to. An
+			      # alternative idiom would be to call it
+			      # the branch the revision is on. This
+			      # reference is to a project-level object
+			      # (symbol or trunk).
 
     # Basic parent/child linkage (lines of development)
 
     variable myparent {} ; # Ref to parent revision object. Link required because of
@@ -209,8 +232,22 @@
 
     # Tag linkage ________________________
 
     variable mytags {} ; # List of tags (objs) associated with this revision.
+
+    # More derived data
+
+    variable myoperation {} ; # One of 'add', 'change', 'delete', or
+			      # 'nothing'. Derived from our and its
+			      # parent's state.
+
+    # dead(self) x dead(parent) -> operation
+    typevariable myopstate -array {
+	{0 0} change
+	{0 1} delete
+	{1 0} add
+	{1 1} nothing
+    }
 
     # # ## ### ##### ######## #############
     ## Internal methods