Differences From:
File
tools/cvs2fossil/lib/c2f_fossil.tcl
part of check-in
[be2f99e6a4]
- Merge with aku's branch.
by
drh on
2008-02-13 14:44:50.
Also file
tools/cvs2fossil/lib/c2f_fossil.tcl
part of check-in
[0d02fe6c7a]
- Report destination file for repository, and fix bug with the naming of the destination triggered when importing a repository in toto.
by
aku on
2008-02-12 04:25:34.
[view]
To:
File
tools/cvs2fossil/lib/c2f_fossil.tcl
part of check-in
[b7fc4d9d04]
- Extended test-import-manifest to return not only the record-id, but the hash uuid as well. Extended the fossil accessor class with methods for regular and branch tagging. Split the initialization from construction (needed for when we split the import pass into three), and a method to set/retrieve the accessor's configuration (persistence across passes).
by
aku on
2008-03-05 03:35:16.
[view]
@@ -29,8 +29,12 @@
# # ## ### ##### ######## #############
## Public API
constructor {} {
+ return
+ }
+
+ method initialize {} {
set myrepository [fileutil::tempfile cvs2fossil_repo_]
set myworkspace [fileutil::tempfile cvs2fossil_wspc_]
::file delete $myworkspace
::file mkdir $myworkspace
@@ -38,11 +42,24 @@
Do new [::file nativename $myrepository]
$self InWorkspace ; Do open [::file nativename $myrepository]
$self RestorePwd
- log write 8 fossil {scratch repository $myrepository}
- log write 8 fossil {scratch workspace $myworkspace}
+ log write 8 fossil {Scratch repository created @ $myrepository}
+ log write 8 fossil {Scratch workspace created @ $myworkspace }
+ return
+ }
+
+ method load {r w} {
+ set myrepository $r
+ set myworkspace $w
+
+ log write 8 fossil {Scratch repository found @ $myrepository}
+ log write 8 fossil {Scratch workspace found @ $myworkspace}
return
+ }
+
+ method space {} {
+ return [list $myrepository $myworkspace]
}
# # ## ### ##### ######## #############
##
@@ -98,10 +115,8 @@
return [array get id]
}
method importrevision {label user message date parent revisions} {
- # TODO = Write the actual import, and up the log level.
-
# Massage the commit message to remember the old user name
# which did the commit in CVS.
set message "By $user:\n$message"
@@ -124,20 +139,54 @@
set res [eval $cmd]
$self RestorePwd
integrity assert {
- [regexp {^inserted as record \d+$} $res]
+ [regexp {^inserted as record \d+, [0-9a-fA-F]+$} $res]
} {Unable to process unexpected fossil output '$res'}
- set uuid [lindex $res 3]
-
- log write 2 fossil {== $uuid}
- log write 2 fossil { }
- log write 2 fossil { }
-
- return $uuid
+ set rid [string trim [lindex $res 3] ,]
+ set uuid [lindex $res 4]
+
+ log write 2 fossil {== $rid ($uuid)}
+
+ return [list $rid $uuid]
+ }
+
+ method tag {uuid name} {
+ log write 2 fossil {Tag '$name' @ $uuid}
+
+ $self InWorkspace
+ Do tag add sym-$name $uuid
+ $self RestorePwd
+ return
+ }
+
+ method branchmark {uuid name} {
+ # We do not mark the trunk
+ if {$name eq ":trunk:"} return
+
+ log write 2 fossil {Begin branch '$name' @ $uuid}
+
+ $self InWorkspace
+ Do tag branch sym-$name $uuid
+ $self RestorePwd
+ return
+ }
+
+ method branchcancel {uuid name} {
+ # The trunk is unmarked, thus cancellation is not needed
+ # either.
+ if {$name eq ":trunk:"} return
+
+ log write 2 fossil {Cancel branch '$name' @ $uuid}
+
+ $self InWorkspace
+ Do tag delete sym-$name $uuid
+ $self RestorePwd
+ return
}
method finalize {destination} {
+ log write 2 fossil {Finalize, rebuilding repository}
Do rebuild [::file nativename $myrepository]
::file rename -force $myrepository $destination
::file delete -force $myworkspace
@@ -191,8 +240,9 @@
## Internal methods
proc Do {args} {
# 8.5: exec $myfossilcmd {*}$args
+ log write 14 fossil {Doing '$args'}
return [eval [linsert $args 0 exec $myfossilcmd]]
}
method InWorkspace {} { set mypwd [pwd] ; cd $myworkspace ; return }