Fossil SCM

Added tracking of file removal in changesets.

aku 2008-02-05 15:52 trunk
Commit c9270189c29457862f24fcb824400a06e3a18123
--- cvs2fossil.txt
+++ cvs2fossil.txt
@@ -1,69 +1,14 @@
11
22
Known problems and areas to work on
33
===================================
44
5
-* Currently not properly tracking when a file is removed on some
6
- branch (detectable by a 'dead' revision (optype)) during the
7
- import of changesets.
8
-
95
* Not yet able to handle the specification of multiple projects
106
for one CVS repository. I.e. I can, for example, import all of
117
tcllib, or a single subproject of tcllib, like tklib, but not
128
multiple sub-projects in one go.
139
14
-* An internal error thrown when trying to import tcllib of
15
- tcllib shows that I am apparently not properly handling the
16
- possibility of more than one symbol used to create a
17
- vendor-branch with.
18
-
19
- In tcllib most files (18) have 'tcllib-vendor-branch' as the
20
- name of their vendor branch, done in 2000, however two files
21
- use the name 'vendor' instead, they were done in 2003. Each
22
- set of files corresponds a single changeset.
23
-
24
- This causes the code importing the changesets to flip out when
25
- the second changeset tries to create ':trunk:' and finds it
26
- already existing (both changesets are the last trunk-changeset
27
- on the vendor branch :) )
28
-
29
- Not sure yet if I should try to abort this at the beginning,
30
- i.e. CVS integrity failure, force the user to manually edit
31
- the RCS archives to bring the symbol used for the vendor
32
- branch into sync. Or if I should allow the import to let this
33
- slide by, by simply assuming that all such second changesets
34
- should not try to create the :trunk: if it exists.
35
-
36
- ---
37
- Another possibility is to somehow identify such symbols and
38
- rewrite the structures on my own, i.e. choose one of the
39
- symbols as the canonical vendor branch V and rewrite all
40
- revisions using other vendor branch symbols to use V. This
41
- would have to happen somewhere in either pass CollateSymbols
42
- or in pass FilterSymbols.
43
-
44
- Thinking about it would have to happen before we even start to
45
- aggregate the branch/tag/commit counts, so that all of them
46
- apply to V later on, instead of spread over several symbols.
47
-
48
- Luckily we have all the relevant information in the state
49
- database, in the tables 'revision' and 'symbol'.
50
-
51
- Thinking even more, this type of symbol rewriting, whether by
52
- the importer, or directly in the rcs archives before doing the
53
- import, will not address the fact that both changesets will
54
- have file revisions in them which declare that they are the
55
- last trunk changeset on the vendor branch, despite the second
56
- changeset added about three years after the previous last
57
- trunk changeset on the vendor branch.
58
-
59
- It seems that I will have to rewrite the changeset import to
60
- simply allow for this situation and force the second changeset
61
- (and any further) to be non-trunk on the vendor-branch,
62
- whatever I do after collecting the revision. And if I do that
63
- I don't really a good reason to rewrite the symbols.
64
-
6510
* An internal error thrown when trying to import bwidget of
6611
tcllib shows that there have to be some situation I am not
6712
handling correctly in the cycle-breaker and sorting passes.
6813
6914
It tries to import a changeset on the
7015
--- cvs2fossil.txt
+++ cvs2fossil.txt
@@ -1,69 +1,14 @@
1
2 Known problems and areas to work on
3 ===================================
4
5 * Currently not properly tracking when a file is removed on some
6 branch (detectable by a 'dead' revision (optype)) during the
7 import of changesets.
8
9 * Not yet able to handle the specification of multiple projects
10 for one CVS repository. I.e. I can, for example, import all of
11 tcllib, or a single subproject of tcllib, like tklib, but not
12 multiple sub-projects in one go.
13
14 * An internal error thrown when trying to import tcllib of
15 tcllib shows that I am apparently not properly handling the
16 possibility of more than one symbol used to create a
17 vendor-branch with.
18
19 In tcllib most files (18) have 'tcllib-vendor-branch' as the
20 name of their vendor branch, done in 2000, however two files
21 use the name 'vendor' instead, they were done in 2003. Each
22 set of files corresponds a single changeset.
23
24 This causes the code importing the changesets to flip out when
25 the second changeset tries to create ':trunk:' and finds it
26 already existing (both changesets are the last trunk-changeset
27 on the vendor branch :) )
28
29 Not sure yet if I should try to abort this at the beginning,
30 i.e. CVS integrity failure, force the user to manually edit
31 the RCS archives to bring the symbol used for the vendor
32 branch into sync. Or if I should allow the import to let this
33 slide by, by simply assuming that all such second changesets
34 should not try to create the :trunk: if it exists.
35
36 ---
37 Another possibility is to somehow identify such symbols and
38 rewrite the structures on my own, i.e. choose one of the
39 symbols as the canonical vendor branch V and rewrite all
40 revisions using other vendor branch symbols to use V. This
41 would have to happen somewhere in either pass CollateSymbols
42 or in pass FilterSymbols.
43
44 Thinking about it would have to happen before we even start to
45 aggregate the branch/tag/commit counts, so that all of them
46 apply to V later on, instead of spread over several symbols.
47
48 Luckily we have all the relevant information in the state
49 database, in the tables 'revision' and 'symbol'.
50
51 Thinking even more, this type of symbol rewriting, whether by
52 the importer, or directly in the rcs archives before doing the
53 import, will not address the fact that both changesets will
54 have file revisions in them which declare that they are the
55 last trunk changeset on the vendor branch, despite the second
56 changeset added about three years after the previous last
57 trunk changeset on the vendor branch.
58
59 It seems that I will have to rewrite the changeset import to
60 simply allow for this situation and force the second changeset
61 (and any further) to be non-trunk on the vendor-branch,
62 whatever I do after collecting the revision. And if I do that
63 I don't really a good reason to rewrite the symbols.
64
65 * An internal error thrown when trying to import bwidget of
66 tcllib shows that there have to be some situation I am not
67 handling correctly in the cycle-breaker and sorting passes.
68
69 It tries to import a changeset on the
70
--- cvs2fossil.txt
+++ cvs2fossil.txt
@@ -1,69 +1,14 @@
1
2 Known problems and areas to work on
3 ===================================
4
 
 
 
 
5 * Not yet able to handle the specification of multiple projects
6 for one CVS repository. I.e. I can, for example, import all of
7 tcllib, or a single subproject of tcllib, like tklib, but not
8 multiple sub-projects in one go.
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10 * An internal error thrown when trying to import bwidget of
11 tcllib shows that there have to be some situation I am not
12 handling correctly in the cycle-breaker and sorting passes.
13
14 It tries to import a changeset on the
15
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -454,18 +454,18 @@
454454
}
455455
456456
proc Getrevisioninfo {revisions} {
457457
set theset ('[join $revisions {','}]')
458458
set revisions {}
459
- foreach {frid path fname revnr} [state run [subst -nocommands -nobackslashes {
460
- SELECT U.uuid, F.visible, F.name, R.rev
459
+ foreach {frid path fname revnr rop} [state run [subst -nocommands -nobackslashes {
460
+ SELECT U.uuid, F.visible, F.name, R.rev, R.op
461461
FROM revision R, revuuid U, file F
462462
WHERE R.rid IN $theset -- All specified revisions
463463
AND U.rid = R.rid -- get fossil uuid of revision
464464
AND F.fid = R.fid -- get file of revision
465465
}]] {
466
- lappend revisions $frid $path $fname/$revnr
466
+ lappend revisions $frid $path $fname/$revnr $rop
467467
}
468468
return $revisions
469469
}
470470
471471
proc Getworkspace {rstate lodname project isdefault} {
472472
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -454,18 +454,18 @@
454 }
455
456 proc Getrevisioninfo {revisions} {
457 set theset ('[join $revisions {','}]')
458 set revisions {}
459 foreach {frid path fname revnr} [state run [subst -nocommands -nobackslashes {
460 SELECT U.uuid, F.visible, F.name, R.rev
461 FROM revision R, revuuid U, file F
462 WHERE R.rid IN $theset -- All specified revisions
463 AND U.rid = R.rid -- get fossil uuid of revision
464 AND F.fid = R.fid -- get file of revision
465 }]] {
466 lappend revisions $frid $path $fname/$revnr
467 }
468 return $revisions
469 }
470
471 proc Getworkspace {rstate lodname project isdefault} {
472
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -454,18 +454,18 @@
454 }
455
456 proc Getrevisioninfo {revisions} {
457 set theset ('[join $revisions {','}]')
458 set revisions {}
459 foreach {frid path fname revnr rop} [state run [subst -nocommands -nobackslashes {
460 SELECT U.uuid, F.visible, F.name, R.rev, R.op
461 FROM revision R, revuuid U, file F
462 WHERE R.rid IN $theset -- All specified revisions
463 AND U.rid = R.rid -- get fossil uuid of revision
464 AND F.fid = R.fid -- get file of revision
465 }]] {
466 lappend revisions $frid $path $fname/$revnr $rop
467 }
468 return $revisions
469 }
470
471 proc Getworkspace {rstate lodname project isdefault} {
472
--- tools/cvs2fossil/lib/c2f_ristate.tcl
+++ tools/cvs2fossil/lib/c2f_ristate.tcl
@@ -57,12 +57,12 @@
5757
[info exists mystate($parentlod)]
5858
} {Trying to inherit from undefined lod "$parentlod"}
5959
6060
set pwss $mystate($parentlod)
6161
62
- $wss add [$pwss get]
63
- $wss defid [$pwss getid]
62
+ $wss defstate [$pwss getstate]
63
+ $wss defid [$pwss getid]
6464
}
6565
6666
return $wss
6767
}
6868
6969
--- tools/cvs2fossil/lib/c2f_ristate.tcl
+++ tools/cvs2fossil/lib/c2f_ristate.tcl
@@ -57,12 +57,12 @@
57 [info exists mystate($parentlod)]
58 } {Trying to inherit from undefined lod "$parentlod"}
59
60 set pwss $mystate($parentlod)
61
62 $wss add [$pwss get]
63 $wss defid [$pwss getid]
64 }
65
66 return $wss
67 }
68
69
--- tools/cvs2fossil/lib/c2f_ristate.tcl
+++ tools/cvs2fossil/lib/c2f_ristate.tcl
@@ -57,12 +57,12 @@
57 [info exists mystate($parentlod)]
58 } {Trying to inherit from undefined lod "$parentlod"}
59
60 set pwss $mystate($parentlod)
61
62 $wss defstate [$pwss getstate]
63 $wss defid [$pwss getid]
64 }
65
66 return $wss
67 }
68
69
--- tools/cvs2fossil/lib/c2f_wsstate.tcl
+++ tools/cvs2fossil/lib/c2f_wsstate.tcl
@@ -18,10 +18,11 @@
1818
## Requirements
1919
2020
package require Tcl 8.4 ; # Required runtime.
2121
package require snit ; # OO system.
2222
package require struct::list ; # List assignment
23
+package require vc::tools::log ; # User feedback.
2324
2425
# # ## ### ##### ######## ############# #####################
2526
##
2627
2728
snit::type ::vc::fossil::import::cvs::wsstate {
@@ -34,21 +35,25 @@
3435
return
3536
}
3637
3738
method name {} { return $myname }
3839
39
- method add {revisioninfo} {
40
- # revisioninfo = list (rid path label ...) /triples
40
+ method add {oprevisioninfo} {
41
+ # oprevisioninfo = list (rid path label op ...) /quadruples
4142
4243
# Overwrite all changed files (identified by path) with the
43
- # new revisions. This keeps all unchanged files.
44
+ # new revisions. This keeps all unchanged files. Files marked
45
+ # as dead are removed.
4446
45
- # BUG / TODO for FIX: Have to recognize dead files, to remove
46
- # them. We need the per-file revision optype for this.
47
+ foreach {rid path label rop} $oprevisioninfo {
48
+ log write 5 wss {$myop($rop) $label}
4749
48
- foreach {rid path label} $revisioninfo {
49
- set mystate($path) [list $rid $label]
50
+ if {$rop < 0} {
51
+ unset mystate($path)
52
+ } else {
53
+ set mystate($path) [list $rid $label]
54
+ }
5055
}
5156
return
5257
}
5358
5459
method get {} {
@@ -65,10 +70,13 @@
6570
return
6671
}
6772
6873
method getid {} { return $myid }
6974
75
+ method defstate {s} { array set mystate $s ; return }
76
+ method getstate {} { return [array get mystate] }
77
+
7078
# # ## ### ##### ######## #############
7179
## State
7280
7381
variable myname {} ; # Name of the LOD the workspace is
7482
# for.
@@ -75,10 +83,17 @@
7583
variable myid {} ; # Record id of the fossil manifest
7684
# associated with the current state.
7785
variable mystate -array {} ; # Map from paths to the recordid of
7886
# the file revision behind it, and
7987
# the associated label for logging.
88
+
89
+ typevariable myop -array {
90
+ -1 REM
91
+ 0 ---
92
+ 1 ADD
93
+ 2 CHG
94
+ }
8095
8196
# # ## ### ##### ######## #############
8297
## Configuration
8398
8499
pragma -hastypeinfo no ; # no type introspection
@@ -89,13 +104,15 @@
89104
}
90105
91106
namespace eval ::vc::fossil::import::cvs {
92107
namespace export wsstate
93108
namespace eval wsstate {
109
+ namespace import ::vc::tools::log
110
+ log register wss
94111
}
95112
}
96113
97114
# # ## ### ##### ######## ############# #####################
98115
## Ready
99116
100117
package provide vc::fossil::import::cvs::wsstate 1.0
101118
return
102119
--- tools/cvs2fossil/lib/c2f_wsstate.tcl
+++ tools/cvs2fossil/lib/c2f_wsstate.tcl
@@ -18,10 +18,11 @@
18 ## Requirements
19
20 package require Tcl 8.4 ; # Required runtime.
21 package require snit ; # OO system.
22 package require struct::list ; # List assignment
 
23
24 # # ## ### ##### ######## ############# #####################
25 ##
26
27 snit::type ::vc::fossil::import::cvs::wsstate {
@@ -34,21 +35,25 @@
34 return
35 }
36
37 method name {} { return $myname }
38
39 method add {revisioninfo} {
40 # revisioninfo = list (rid path label ...) /triples
41
42 # Overwrite all changed files (identified by path) with the
43 # new revisions. This keeps all unchanged files.
 
44
45 # BUG / TODO for FIX: Have to recognize dead files, to remove
46 # them. We need the per-file revision optype for this.
47
48 foreach {rid path label} $revisioninfo {
49 set mystate($path) [list $rid $label]
 
 
 
50 }
51 return
52 }
53
54 method get {} {
@@ -65,10 +70,13 @@
65 return
66 }
67
68 method getid {} { return $myid }
69
 
 
 
70 # # ## ### ##### ######## #############
71 ## State
72
73 variable myname {} ; # Name of the LOD the workspace is
74 # for.
@@ -75,10 +83,17 @@
75 variable myid {} ; # Record id of the fossil manifest
76 # associated with the current state.
77 variable mystate -array {} ; # Map from paths to the recordid of
78 # the file revision behind it, and
79 # the associated label for logging.
 
 
 
 
 
 
 
80
81 # # ## ### ##### ######## #############
82 ## Configuration
83
84 pragma -hastypeinfo no ; # no type introspection
@@ -89,13 +104,15 @@
89 }
90
91 namespace eval ::vc::fossil::import::cvs {
92 namespace export wsstate
93 namespace eval wsstate {
 
 
94 }
95 }
96
97 # # ## ### ##### ######## ############# #####################
98 ## Ready
99
100 package provide vc::fossil::import::cvs::wsstate 1.0
101 return
102
--- tools/cvs2fossil/lib/c2f_wsstate.tcl
+++ tools/cvs2fossil/lib/c2f_wsstate.tcl
@@ -18,10 +18,11 @@
18 ## Requirements
19
20 package require Tcl 8.4 ; # Required runtime.
21 package require snit ; # OO system.
22 package require struct::list ; # List assignment
23 package require vc::tools::log ; # User feedback.
24
25 # # ## ### ##### ######## ############# #####################
26 ##
27
28 snit::type ::vc::fossil::import::cvs::wsstate {
@@ -34,21 +35,25 @@
35 return
36 }
37
38 method name {} { return $myname }
39
40 method add {oprevisioninfo} {
41 # oprevisioninfo = list (rid path label op ...) /quadruples
42
43 # Overwrite all changed files (identified by path) with the
44 # new revisions. This keeps all unchanged files. Files marked
45 # as dead are removed.
46
47 foreach {rid path label rop} $oprevisioninfo {
48 log write 5 wss {$myop($rop) $label}
49
50 if {$rop < 0} {
51 unset mystate($path)
52 } else {
53 set mystate($path) [list $rid $label]
54 }
55 }
56 return
57 }
58
59 method get {} {
@@ -65,10 +70,13 @@
70 return
71 }
72
73 method getid {} { return $myid }
74
75 method defstate {s} { array set mystate $s ; return }
76 method getstate {} { return [array get mystate] }
77
78 # # ## ### ##### ######## #############
79 ## State
80
81 variable myname {} ; # Name of the LOD the workspace is
82 # for.
@@ -75,10 +83,17 @@
83 variable myid {} ; # Record id of the fossil manifest
84 # associated with the current state.
85 variable mystate -array {} ; # Map from paths to the recordid of
86 # the file revision behind it, and
87 # the associated label for logging.
88
89 typevariable myop -array {
90 -1 REM
91 0 ---
92 1 ADD
93 2 CHG
94 }
95
96 # # ## ### ##### ######## #############
97 ## Configuration
98
99 pragma -hastypeinfo no ; # no type introspection
@@ -89,13 +104,15 @@
104 }
105
106 namespace eval ::vc::fossil::import::cvs {
107 namespace export wsstate
108 namespace eval wsstate {
109 namespace import ::vc::tools::log
110 log register wss
111 }
112 }
113
114 # # ## ### ##### ######## ############# #####################
115 ## Ready
116
117 package provide vc::fossil::import::cvs::wsstate 1.0
118 return
119

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button