Fossil SCM
Changeset handling, extended logging of how parent is determined. Fossil access, fixed importrev call to use correct workspace/repository. Fixed handling of output, stripping unwanted text, checking of output syntax. Extended logging. Added final 'rebuild'. NOTE: formation of the changesets/manifests is buggy, is not tracking unchanged files across changesets. Further not yet tracking when files have been removed.
Commit
9214c1183140fdbfec9a57640ba1f6fa9bf7c415
Parent
dfb6ee3bac8b573…
2 files changed
+18
-1
+14
-3
+18
-1
| --- tools/cvs2fossil/lib/c2f_fossil.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_fossil.tcl | ||
| @@ -36,10 +36,13 @@ | ||
| 36 | 36 | ::file mkdir $myworkspace |
| 37 | 37 | |
| 38 | 38 | Do new [::file nativename $myrepository] |
| 39 | 39 | $self InWorkspace ; Do open [::file nativename $myrepository] |
| 40 | 40 | $self RestorePwd |
| 41 | + | |
| 42 | + log write 8 fossil {scratch repository $myrepository} | |
| 43 | + log write 8 fossil {scratch workspace $myworkspace} | |
| 41 | 44 | return |
| 42 | 45 | } |
| 43 | 46 | |
| 44 | 47 | # # ## ### ##### ######## ############# |
| 45 | 48 | ## |
| @@ -113,17 +116,31 @@ | ||
| 113 | 116 | lappend cmd -f $frid $fpath |
| 114 | 117 | log write 2 fossil {** <[format %5d $frid]> = <$flabel>} |
| 115 | 118 | } |
| 116 | 119 | |
| 117 | 120 | # run fossil test-command performing the import. |
| 118 | - set uuid [eval $cmd] | |
| 121 | + log write 8 fossil { [lreplace $cmd 3 3 @@]} | |
| 122 | + | |
| 123 | + $self InWorkspace | |
| 124 | + set res [eval $cmd] | |
| 125 | + $self RestorePwd | |
| 126 | + | |
| 127 | + integrity assert { | |
| 128 | + [regexp {^inserted as record \d+$} $res] | |
| 129 | + } {Unable to process unexpected fossil output '$res'} | |
| 130 | + set uuid [lindex $res 3] | |
| 119 | 131 | |
| 120 | 132 | log write 2 fossil {== $uuid} |
| 133 | + log write 2 fossil { } | |
| 134 | + log write 2 fossil { } | |
| 135 | + | |
| 121 | 136 | return $uuid |
| 122 | 137 | } |
| 123 | 138 | |
| 124 | 139 | method finalize {destination} { |
| 140 | + Do rebuild [::file nativename $myrepository] | |
| 141 | + | |
| 125 | 142 | ::file rename -force $myrepository $destination |
| 126 | 143 | ::file delete -force $myworkspace |
| 127 | 144 | $self destroy |
| 128 | 145 | return |
| 129 | 146 | } |
| 130 | 147 |
| --- tools/cvs2fossil/lib/c2f_fossil.tcl | |
| +++ tools/cvs2fossil/lib/c2f_fossil.tcl | |
| @@ -36,10 +36,13 @@ | |
| 36 | ::file mkdir $myworkspace |
| 37 | |
| 38 | Do new [::file nativename $myrepository] |
| 39 | $self InWorkspace ; Do open [::file nativename $myrepository] |
| 40 | $self RestorePwd |
| 41 | return |
| 42 | } |
| 43 | |
| 44 | # # ## ### ##### ######## ############# |
| 45 | ## |
| @@ -113,17 +116,31 @@ | |
| 113 | lappend cmd -f $frid $fpath |
| 114 | log write 2 fossil {** <[format %5d $frid]> = <$flabel>} |
| 115 | } |
| 116 | |
| 117 | # run fossil test-command performing the import. |
| 118 | set uuid [eval $cmd] |
| 119 | |
| 120 | log write 2 fossil {== $uuid} |
| 121 | return $uuid |
| 122 | } |
| 123 | |
| 124 | method finalize {destination} { |
| 125 | ::file rename -force $myrepository $destination |
| 126 | ::file delete -force $myworkspace |
| 127 | $self destroy |
| 128 | return |
| 129 | } |
| 130 |
| --- tools/cvs2fossil/lib/c2f_fossil.tcl | |
| +++ tools/cvs2fossil/lib/c2f_fossil.tcl | |
| @@ -36,10 +36,13 @@ | |
| 36 | ::file mkdir $myworkspace |
| 37 | |
| 38 | Do new [::file nativename $myrepository] |
| 39 | $self InWorkspace ; Do open [::file nativename $myrepository] |
| 40 | $self RestorePwd |
| 41 | |
| 42 | log write 8 fossil {scratch repository $myrepository} |
| 43 | log write 8 fossil {scratch workspace $myworkspace} |
| 44 | return |
| 45 | } |
| 46 | |
| 47 | # # ## ### ##### ######## ############# |
| 48 | ## |
| @@ -113,17 +116,31 @@ | |
| 116 | lappend cmd -f $frid $fpath |
| 117 | log write 2 fossil {** <[format %5d $frid]> = <$flabel>} |
| 118 | } |
| 119 | |
| 120 | # run fossil test-command performing the import. |
| 121 | log write 8 fossil { [lreplace $cmd 3 3 @@]} |
| 122 | |
| 123 | $self InWorkspace |
| 124 | set res [eval $cmd] |
| 125 | $self RestorePwd |
| 126 | |
| 127 | integrity assert { |
| 128 | [regexp {^inserted as record \d+$} $res] |
| 129 | } {Unable to process unexpected fossil output '$res'} |
| 130 | set uuid [lindex $res 3] |
| 131 | |
| 132 | log write 2 fossil {== $uuid} |
| 133 | log write 2 fossil { } |
| 134 | log write 2 fossil { } |
| 135 | |
| 136 | return $uuid |
| 137 | } |
| 138 | |
| 139 | method finalize {destination} { |
| 140 | Do rebuild [::file nativename $myrepository] |
| 141 | |
| 142 | ::file rename -force $myrepository $destination |
| 143 | ::file delete -force $myworkspace |
| 144 | $self destroy |
| 145 | return |
| 146 | } |
| 147 |
+14
-3
| --- tools/cvs2fossil/lib/c2f_prev.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_prev.tcl | ||
| @@ -446,10 +446,18 @@ | ||
| 446 | 446 | |
| 447 | 447 | proc Getparent {sv lodname project items} { |
| 448 | 448 | upvar 1 $sv state |
| 449 | 449 | |
| 450 | 450 | struct::list assign [Getisdefault $items] isdefault lastdefaultontrunk |
| 451 | + | |
| 452 | + log write 8 csets {LOD '$lodname'} | |
| 453 | + log write 8 csets { def? $isdefault} | |
| 454 | + log write 8 csets { last? $lastdefaultontrunk} | |
| 455 | + | |
| 456 | + foreach k [lsort [array names state]] { | |
| 457 | + log write 8 csets { $k = $state($k)} | |
| 458 | + } | |
| 451 | 459 | |
| 452 | 460 | # See (a) below, we have to remember if the changeset is last |
| 453 | 461 | # on vendor branch also belonging to trunk even if we find a |
| 454 | 462 | # parent in the state. The caller will later (after import) |
| 455 | 463 | # make us the first trunk changeset in the state (See (**)). |
| @@ -498,13 +506,16 @@ | ||
| 498 | 506 | |
| 499 | 507 | # Case (c). We find the parent LOD of our LOD and take the |
| 500 | 508 | # last changeset committed to that as our parent. If that |
| 501 | 509 | # doesn't exist we have an error on our hands. |
| 502 | 510 | |
| 503 | - set lodname [[[$project getsymbol $lodname] parent] name] | |
| 504 | - if {[info exists state($lodname)]} { | |
| 505 | - return $state($lodname) | |
| 511 | + set plodname [[[$project getsymbol $lodname] parent] name] | |
| 512 | + | |
| 513 | + log write 8 csets {pLOD '$plodname'} | |
| 514 | + | |
| 515 | + if {[info exists state($plodname)]} { | |
| 516 | + return $state($plodname) | |
| 506 | 517 | } |
| 507 | 518 | |
| 508 | 519 | trouble internal {Unable to determine changeset parent} |
| 509 | 520 | return |
| 510 | 521 | } |
| 511 | 522 |
| --- tools/cvs2fossil/lib/c2f_prev.tcl | |
| +++ tools/cvs2fossil/lib/c2f_prev.tcl | |
| @@ -446,10 +446,18 @@ | |
| 446 | |
| 447 | proc Getparent {sv lodname project items} { |
| 448 | upvar 1 $sv state |
| 449 | |
| 450 | struct::list assign [Getisdefault $items] isdefault lastdefaultontrunk |
| 451 | |
| 452 | # See (a) below, we have to remember if the changeset is last |
| 453 | # on vendor branch also belonging to trunk even if we find a |
| 454 | # parent in the state. The caller will later (after import) |
| 455 | # make us the first trunk changeset in the state (See (**)). |
| @@ -498,13 +506,16 @@ | |
| 498 | |
| 499 | # Case (c). We find the parent LOD of our LOD and take the |
| 500 | # last changeset committed to that as our parent. If that |
| 501 | # doesn't exist we have an error on our hands. |
| 502 | |
| 503 | set lodname [[[$project getsymbol $lodname] parent] name] |
| 504 | if {[info exists state($lodname)]} { |
| 505 | return $state($lodname) |
| 506 | } |
| 507 | |
| 508 | trouble internal {Unable to determine changeset parent} |
| 509 | return |
| 510 | } |
| 511 |
| --- tools/cvs2fossil/lib/c2f_prev.tcl | |
| +++ tools/cvs2fossil/lib/c2f_prev.tcl | |
| @@ -446,10 +446,18 @@ | |
| 446 | |
| 447 | proc Getparent {sv lodname project items} { |
| 448 | upvar 1 $sv state |
| 449 | |
| 450 | struct::list assign [Getisdefault $items] isdefault lastdefaultontrunk |
| 451 | |
| 452 | log write 8 csets {LOD '$lodname'} |
| 453 | log write 8 csets { def? $isdefault} |
| 454 | log write 8 csets { last? $lastdefaultontrunk} |
| 455 | |
| 456 | foreach k [lsort [array names state]] { |
| 457 | log write 8 csets { $k = $state($k)} |
| 458 | } |
| 459 | |
| 460 | # See (a) below, we have to remember if the changeset is last |
| 461 | # on vendor branch also belonging to trunk even if we find a |
| 462 | # parent in the state. The caller will later (after import) |
| 463 | # make us the first trunk changeset in the state (See (**)). |
| @@ -498,13 +506,16 @@ | |
| 506 | |
| 507 | # Case (c). We find the parent LOD of our LOD and take the |
| 508 | # last changeset committed to that as our parent. If that |
| 509 | # doesn't exist we have an error on our hands. |
| 510 | |
| 511 | set plodname [[[$project getsymbol $lodname] parent] name] |
| 512 | |
| 513 | log write 8 csets {pLOD '$plodname'} |
| 514 | |
| 515 | if {[info exists state($plodname)]} { |
| 516 | return $state($plodname) |
| 517 | } |
| 518 | |
| 519 | trouble internal {Unable to determine changeset parent} |
| 520 | return |
| 521 | } |
| 522 |