Overview
SHA1 Hash: | b7fc4d9d047d993a345ef54bdf50e0b5ecae58a7 |
---|---|
Date: | 2008-03-05 03:35:16 |
User: | aku |
Comment: | 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). |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/checkin.c from [f5120aa9ee] to [b8e054206a].
@@ -587,10 +587,12 @@ Blob cksum, cksum2; /* Before and after commit checksums */ Blob cksum1b; /* Checksum recorded in the manifest */ const char* parent; /* loop variable when collecting parent references */ int i, mid; /* Another loop index, and id of new manifest */ Stmt q; /* sql statement to query table of files */ + char* zMidUuid; /* Uuid for the newly generated manifest */ + #define USAGE ("DATE COMMENT ?-p|-parent PARENT_RID...? ?-f|-file (FILE_RID PATH)...?") /* ** Validate and process arguments, collect information. @@ -805,18 +807,21 @@ ** At last commit all changes, after getting rid of the temp ** holder for the files, and release allocated memory. */ db_multi_exec("DROP TABLE __im"); + zMidUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", mid); db_end_transaction(0); free(zParents); /* - ** At the very last inform the caller about the id of the new - ** manifest. + ** At the very last inform the caller about the id and uuid of the + ** new manifest. */ - printf("inserted as record %d\n", mid); + + printf("inserted as record %d, %s\n", mid, zMidUuid); + free(zMidUuid); return; #undef USAGE }
Modified tools/cvs2fossil/lib/c2f_fossil.tcl from [3f0dcfd428] to [55a6ec9011].
@@ -28,22 +28,39 @@ snit::type ::vc::fossil::import::cvs::fossil { # # ## ### ##### ######## ############# ## Public API constructor {} { + return + } + + method initialize {} { set myrepository [fileutil::tempfile cvs2fossil_repo_] set myworkspace [fileutil::tempfile cvs2fossil_wspc_] ::file delete $myworkspace ::file mkdir $myworkspace 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] } # # ## ### ##### ######## ############# ## @@ -97,12 +114,10 @@ log write 3 fossil Done. 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" @@ -123,22 +138,56 @@ $self InWorkspace 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 $self destroy @@ -190,10 +239,11 @@ # # ## ### ##### ######## ############# ## 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 } method RestorePwd {} { cd $mypwd ; set mypwd {} ; return }