Fossil SCM

Extended main import method (pushto) to handle all types of changesets, not only revisions. Tag changesets lead to tagging of imported revisions, branch changesets reflect the proper location where branches start, and make it possible to handle tagging of branches without revisions as well. Modified code returning changesets for a projects to return all, not only revision, in sync with the previous. Changed the code determining tag/branch lod's to use table 'preferedparent'.

aku 2008-03-05 03:42 trunk
Commit 983090a343ce820090eeac15f69e4d77373431fc
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -89,11 +89,11 @@
8989
append str "$mytype ${myid}${detail}>"
9090
return $str
9191
}
9292
9393
method lod {} {
94
- return [$mytypeobj cs_lod $myitems]
94
+ return [$mytypeobj cs_lod $mysrcid $myitems]
9595
}
9696
9797
method id {} { return $myid }
9898
method items {} { return $mytitems }
9999
method data {} { return [list $myproject $mytype $mysrcid] }
@@ -261,60 +261,148 @@
261261
# - The parent changeset, if any. If there is no parent fossil
262262
# will use the empty base revision as parent.
263263
#
264264
# - List of the file revisions in the changeset.
265265
266
- struct::list assign [$myproject getmeta $mysrcid] __ __ user message
267
-
268266
# We derive the lod information directly from the revisions of
269267
# the changeset, as the branch part of the meta data (s.a.) is
270
- # outdated since pass FilterSymbols.
268
+ # outdated since pass FilterSymbols. See the method 'run' in
269
+ # file "c2f_pfiltersym.tcl" for more commentary on this.
271270
272271
set lodname [$self lod]
273272
274
- log write 2 csets {Importing revision [$self str] on $lodname}
275
-
276
- # Perform the import. As part of that we determine the parent
277
- # we need, and convert the list of items in the changeset into
278
- # uuids and printable data.
279
-
280
- struct::list assign [Getisdefault $myitems] isdefault lastdefaultontrunk
281
-
282
- log write 8 csets {LOD '$lodname'}
283
- log write 8 csets { def? $isdefault}
284
- log write 8 csets { last? $lastdefaultontrunk}
285
-
286
- set lws [Getworkspace $rstate $lodname $myproject $isdefault]
287
- $lws add [Getrevisioninfo $myitems]
288
-
289
- set uuid [$repository importrevision [$self str] \
290
- $user $message $date \
291
- [$lws getid] [$lws get]]
292
-
293
- # Remember the imported changeset in the state, under our
294
- # LOD. And if it is the last trunk changeset on the vendor
295
- # branch then the revision is also the actual root of the
296
- # :trunk:, so we remember it as such in the state. However if
297
- # the trunk already exists then the changeset cannot be on it
298
- # any more. This indicates weirdness in the setup of the
299
- # vendor branch, but one we can work around.
300
-
301
- $lws defid $uuid
302
- if {$lastdefaultontrunk} {
303
- if {[$rstate has :trunk:]} {
304
- log write 2 csets {Multiple changesets declared to be the last trunk changeset on the vendor-branch}
273
+ log write 2 csets {Importing changeset [$self str] on $lodname}
274
+
275
+ if {[$mytypeobj istag]} {
276
+ # Handle tags. They appear immediately after the revision
277
+ # they are attached to (*). We can assume that the
278
+ # workspace for the relevant line of development
279
+ # exists. We retrieve it, then the uuid of the last
280
+ # revision entered into it, then tag this revision.
281
+
282
+ # (*) Immediately in terms of the relevant line of
283
+ # development. Revisions on other lines may come in
284
+ # between, but they do not matter to that.
285
+
286
+ set lws [Getworkspace $rstate $lodname $myproject 0]
287
+ set uuid [lindex [$lws getid] 1]
288
+
289
+ $repository tag $uuid [state one {
290
+ SELECT S.name
291
+ FROM symbol S
292
+ WHERE S.sid = $mysrcid
293
+ }]
294
+
295
+ } elseif {[$mytypeobj isbranch]} {
296
+
297
+ # Handle branches. They appear immediately after the
298
+ # revision they are spawned from (*). We can assume that
299
+ # the workspace for the relevant line of development
300
+ # exists.
301
+
302
+ # We retrieve it, then the uuid of the last revision
303
+ # entered into it. That revision is tagged as the root of
304
+ # the branch (**). A new workspace for the branch is
305
+ # created as well, for the future revisions of the new
306
+ # line of development.
307
+
308
+ # An exception is made of the non-trunk default branch,
309
+ # aka vendor branch. This lod has to have a workspace not
310
+ # inherited from anything else. It has no root either, so
311
+ # tagging is out as well.
312
+
313
+ # (*) Immediately in terms of the relevant line of
314
+ # development. Revisions on other lines may come in
315
+ # between, but they do not matter to that.
316
+
317
+ # (**) Tagging the parent revision of the branch as its
318
+ # root is done to let us know about the existence of
319
+ # the branch even if it has no revisions committed to
320
+ # it, and thus no regular branch tag anywhere else.
321
+ # The name of the tag is the name for the lod, with
322
+ # the suffix '-root' appended to it.
323
+
324
+ # LOD is self symbol of branch, not parent
325
+ set lodname [state one {
326
+ SELECT S.name
327
+ FROM symbol S
328
+ WHERE S.sid = $mysrcid
329
+ }]
330
+
331
+ if {![$rstate has :trunk:]} {
332
+ # No trunk implies default branch. Just create the
333
+ # proper workspace.
334
+ Getworkspace $rstate $lodname $myproject 1
305335
} else {
306
- $rstate new :trunk: [$lws name]
336
+ # Non-default branch. Need workspace, and tag parent
337
+ # revision.
338
+
339
+ set lws [Getworkspace $rstate $lodname $myproject 0]
340
+ set uuid [lindex [$lws getid] 1]
341
+
342
+ $repository tag $uuid ${lodname}-root
343
+ }
344
+ } else {
345
+ # Revision changeset.
346
+
347
+ struct::list assign [$myproject getmeta $mysrcid] __ __ user message
348
+
349
+ # Perform the import. As part of that we determine the
350
+ # parent we need, and convert the list of items in the
351
+ # changeset into uuids and printable data.
352
+
353
+ struct::list assign [Getisdefault $myitems] \
354
+ isdefault lastdefaultontrunk
355
+
356
+ log write 8 csets {LOD '$lodname'}
357
+ log write 8 csets { def? $isdefault}
358
+ log write 8 csets { last? $lastdefaultontrunk}
359
+
360
+ set lws [Getworkspace $rstate $lodname $myproject $isdefault]
361
+ $lws add [Getrevisioninfo $myitems]
362
+
363
+ struct::list assign \
364
+ [$repository importrevision [$self str] \
365
+ $user $message $date \
366
+ [lindex [$lws getid] 0] [$lws get]] \
367
+ rid uuid
368
+
369
+ if {[$lws ticks] == 1} {
370
+ # First commit on this line of development. Set our
371
+ # own name as a propagating tag. And if the LOD has a
372
+ # parent we have to prevent the propagation of that
373
+ # tag into this new line.
374
+
375
+ set plws [$lws parent]
376
+ if {$plws ne ""} {
377
+ $repository branchcancel $uuid [$plws name]
378
+ }
379
+ $repository branchmark $uuid [$lws name]
380
+ }
381
+
382
+ # Remember the imported changeset in the state, under our
383
+ # LOD. And if it is the last trunk changeset on the vendor
384
+ # branch then the revision is also the actual root of the
385
+ # :trunk:, so we remember it as such in the state. However
386
+ # if the trunk already exists then the changeset cannot be
387
+ # on it any more. This indicates weirdness in the setup of
388
+ # the vendor branch, but one we can work around.
389
+
390
+ $lws defid [list $rid $uuid]
391
+ if {$lastdefaultontrunk} {
392
+ log write 2 csets {This cset is the last on the NTDB, set the trunk workspace up}
393
+
394
+ if {[$rstate has :trunk:]} {
395
+ log write 2 csets {Multiple changesets declared to be the last trunk changeset on the vendor-branch}
396
+ } else {
397
+ $rstate new :trunk: [$lws name]
398
+ }
307399
}
308400
}
309401
310
- # Remember the whole changeset / uuid mapping, for the tags.
311
-
312
- state run {
313
- INSERT INTO csuuid (cid, uuid)
314
- VALUES ($myid, $uuid)
315
- }
402
+ log write 2 csets { }
403
+ log write 2 csets { }
316404
return
317405
}
318406
319407
proc Getrevisioninfo {revisions} {
320408
set theset ('[join $revisions {','}]')
@@ -372,15 +460,21 @@
372460
# as well, making it inherit the state of the last
373461
# trunk-changeset on the vendor-branch.
374462
375463
if {$isdefault} {
376464
if {![$rstate has ":vendor:"]} {
377
- # Create the vendor branch if not present already.
378
- $rstate new :vendor:
465
+ # Create the vendor branch if not present already. We
466
+ # use the actual name for the lod, and additional make
467
+ # it accessible under an internal name (:vendor:) so
468
+ # that we can merge to it later, should it become
469
+ # necessary. See the other branch below.
470
+ $rstate new $lodname
471
+ $rstate dup :vendor: <-- $lodname
472
+ } else {
473
+ # Merge the new symbol to the vendor branch
474
+ $rstate dup $lodname <-- :vendor:
379475
}
380
- # Merge the new symbol to the vendor branch
381
- $rstate dup $lodname <-- :vendor:
382476
return [$rstate get $lodname]
383477
}
384478
385479
if {$lodname eq ":trunk:"} {
386480
return [$rstate new $lodname]
@@ -573,21 +667,21 @@
573667
# the names in the table 'cstype'
574668
# in sync with the names of the
575669
# helper singletons.
576670
577671
typemethod inorder {projectid} {
578
- # Return all revision changesets for the specified project, in
579
- # the order given to them by the sort passes. Both the
580
- # filtering by project and sorting make use of 'project::rev
581
- # rev' impossible.
672
+ # Return all changesets (object references) for the specified
673
+ # project, in the order given to them by the sort passes. Both
674
+ # the filtering by project and the sorting by time make the
675
+ # use of 'project::rev rev' impossible.
582676
583677
set res {}
584678
state foreachrow {
585
- SELECT C.cid AS xcid, T.date AS cdate
679
+ SELECT C.cid AS xcid,
680
+ T.date AS cdate
586681
FROM changeset C, cstimestamp T
587
- WHERE C.type = 0 -- limit to revision changesets
588
- AND C.pid = $projectid -- limit to changesets in project
682
+ WHERE C.pid = $projectid -- limit to changesets in project
589683
AND T.cid = C.cid -- get ordering information
590684
ORDER BY T.date -- sort into commit order
591685
} {
592686
lappend res $myidmap($xcid) $cdate
593687
}
@@ -1420,16 +1514,26 @@
14201514
AND B.root = R.rid -- Select branches attached to them
14211515
AND CI.iid = B.bid -- Select all changesets
14221516
AND C.cid = CI.cid -- containing the branches
14231517
AND C.type = 2 -- which are branch changesets
14241518
}]]
1519
+
1520
+ # Regarding rev -> branch|tag, we could consider looking at
1521
+ # the symbol of the branch|tag, its lod-symbol, and the
1522
+ # revisions on that lod, but don't. Because it is not exact
1523
+ # enough, the branch|tag would depend on revisions coming
1524
+ # after its creation on the parental lod.
14251525
}
14261526
14271527
# result = symbol name
1428
- typemethod cs_lod {revisions} {
1528
+ typemethod cs_lod {metaid revisions} {
14291529
# Determines the name of the symbol which is the line of
1430
- # development for the revisions in a changeset.
1530
+ # development for the revisions in a changeset. The
1531
+ # information in the meta data referenced by the source metaid
1532
+ # is out of date by the time we come here (since pass
1533
+ # FilterSymbols), so it cannot be used. See the method 'run'
1534
+ # in file "c2f_pfiltersym.tcl" for more commentary on this.
14311535
14321536
set theset ('[join $revisions {','}]')
14331537
return [state run [subst -nocommands -nobackslashes {
14341538
SELECT
14351539
DISTINCT L.name
@@ -1492,22 +1596,22 @@
14921596
# Tags have no successors.
14931597
return
14941598
}
14951599
14961600
# result = symbol name
1497
- typemethod cs_lod {tags} {
1601
+ typemethod cs_lod {sid tags} {
14981602
# Determines the name of the symbol which is the line of
1499
- # development for the tags in a changeset.
1500
-
1501
- set theset ('[join $tags {','}]')
1502
- return [state run [subst -nocommands -nobackslashes {
1503
- SELECT
1504
- DISTINCT L.name
1505
- FROM tag T, symbol L
1506
- WHERE T.tid in $theset -- Restrict to tags of interest
1507
- AND L.sid = T.lod -- Get lod symbol of tag
1508
- }]]
1603
+ # development for the tags in a changeset. Comes directly from
1604
+ # the symbol which is the changeset's source and its prefered
1605
+ # parent.
1606
+
1607
+ return [state run {
1608
+ SELECT P.name
1609
+ FROM preferedparent SP, symbol P
1610
+ WHERE SP.sid = $sid
1611
+ AND P.sid = SP.pid
1612
+ }]
15091613
}
15101614
}
15111615
15121616
# # ## ### ##### ######## ############# #####################
15131617
## Helper singleton. Commands for branch symbol changesets.
@@ -1640,22 +1744,22 @@
16401744
}]]
16411745
return
16421746
}
16431747
16441748
# result = symbol name
1645
- typemethod cs_lod {branches} {
1749
+ typemethod cs_lod {sid branches} {
16461750
# Determines the name of the symbol which is the line of
1647
- # development for the branches in a changeset.
1648
-
1649
- set theset ('[join $branches {','}]')
1650
- return [state run [subst -nocommands -nobackslashes {
1651
- SELECT
1652
- DISTINCT L.name
1653
- FROM branch B, symbol L
1654
- WHERE B.bid in $theset -- Restrict to branches of interest
1655
- AND L.sid = B.lod -- Get lod symbol of branch
1656
- }]]
1751
+ # development for the branches in a changeset. Comes directly
1752
+ # from the symbol which is the changeset's source and its
1753
+ # prefered parent.
1754
+
1755
+ return [state run {
1756
+ SELECT P.name
1757
+ FROM preferedparent SP, symbol P
1758
+ WHERE SP.sid = $sid
1759
+ AND P.sid = SP.pid
1760
+ }]
16571761
}
16581762
16591763
typemethod limits {branches} {
16601764
# Notes. This method exists only for branches. It is needed to
16611765
# get detailed information about a backward branch. It does
16621766
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -89,11 +89,11 @@
89 append str "$mytype ${myid}${detail}>"
90 return $str
91 }
92
93 method lod {} {
94 return [$mytypeobj cs_lod $myitems]
95 }
96
97 method id {} { return $myid }
98 method items {} { return $mytitems }
99 method data {} { return [list $myproject $mytype $mysrcid] }
@@ -261,60 +261,148 @@
261 # - The parent changeset, if any. If there is no parent fossil
262 # will use the empty base revision as parent.
263 #
264 # - List of the file revisions in the changeset.
265
266 struct::list assign [$myproject getmeta $mysrcid] __ __ user message
267
268 # We derive the lod information directly from the revisions of
269 # the changeset, as the branch part of the meta data (s.a.) is
270 # outdated since pass FilterSymbols.
 
271
272 set lodname [$self lod]
273
274 log write 2 csets {Importing revision [$self str] on $lodname}
275
276 # Perform the import. As part of that we determine the parent
277 # we need, and convert the list of items in the changeset into
278 # uuids and printable data.
279
280 struct::list assign [Getisdefault $myitems] isdefault lastdefaultontrunk
281
282 log write 8 csets {LOD '$lodname'}
283 log write 8 csets { def? $isdefault}
284 log write 8 csets { last? $lastdefaultontrunk}
285
286 set lws [Getworkspace $rstate $lodname $myproject $isdefault]
287 $lws add [Getrevisioninfo $myitems]
288
289 set uuid [$repository importrevision [$self str] \
290 $user $message $date \
291 [$lws getid] [$lws get]]
292
293 # Remember the imported changeset in the state, under our
294 # LOD. And if it is the last trunk changeset on the vendor
295 # branch then the revision is also the actual root of the
296 # :trunk:, so we remember it as such in the state. However if
297 # the trunk already exists then the changeset cannot be on it
298 # any more. This indicates weirdness in the setup of the
299 # vendor branch, but one we can work around.
300
301 $lws defid $uuid
302 if {$lastdefaultontrunk} {
303 if {[$rstate has :trunk:]} {
304 log write 2 csets {Multiple changesets declared to be the last trunk changeset on the vendor-branch}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
305 } else {
306 $rstate new :trunk: [$lws name]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
307 }
308 }
309
310 # Remember the whole changeset / uuid mapping, for the tags.
311
312 state run {
313 INSERT INTO csuuid (cid, uuid)
314 VALUES ($myid, $uuid)
315 }
316 return
317 }
318
319 proc Getrevisioninfo {revisions} {
320 set theset ('[join $revisions {','}]')
@@ -372,15 +460,21 @@
372 # as well, making it inherit the state of the last
373 # trunk-changeset on the vendor-branch.
374
375 if {$isdefault} {
376 if {![$rstate has ":vendor:"]} {
377 # Create the vendor branch if not present already.
378 $rstate new :vendor:
 
 
 
 
 
 
 
 
379 }
380 # Merge the new symbol to the vendor branch
381 $rstate dup $lodname <-- :vendor:
382 return [$rstate get $lodname]
383 }
384
385 if {$lodname eq ":trunk:"} {
386 return [$rstate new $lodname]
@@ -573,21 +667,21 @@
573 # the names in the table 'cstype'
574 # in sync with the names of the
575 # helper singletons.
576
577 typemethod inorder {projectid} {
578 # Return all revision changesets for the specified project, in
579 # the order given to them by the sort passes. Both the
580 # filtering by project and sorting make use of 'project::rev
581 # rev' impossible.
582
583 set res {}
584 state foreachrow {
585 SELECT C.cid AS xcid, T.date AS cdate
 
586 FROM changeset C, cstimestamp T
587 WHERE C.type = 0 -- limit to revision changesets
588 AND C.pid = $projectid -- limit to changesets in project
589 AND T.cid = C.cid -- get ordering information
590 ORDER BY T.date -- sort into commit order
591 } {
592 lappend res $myidmap($xcid) $cdate
593 }
@@ -1420,16 +1514,26 @@
1420 AND B.root = R.rid -- Select branches attached to them
1421 AND CI.iid = B.bid -- Select all changesets
1422 AND C.cid = CI.cid -- containing the branches
1423 AND C.type = 2 -- which are branch changesets
1424 }]]
 
 
 
 
 
 
1425 }
1426
1427 # result = symbol name
1428 typemethod cs_lod {revisions} {
1429 # Determines the name of the symbol which is the line of
1430 # development for the revisions in a changeset.
 
 
 
 
1431
1432 set theset ('[join $revisions {','}]')
1433 return [state run [subst -nocommands -nobackslashes {
1434 SELECT
1435 DISTINCT L.name
@@ -1492,22 +1596,22 @@
1492 # Tags have no successors.
1493 return
1494 }
1495
1496 # result = symbol name
1497 typemethod cs_lod {tags} {
1498 # Determines the name of the symbol which is the line of
1499 # development for the tags in a changeset.
1500
1501 set theset ('[join $tags {','}]')
1502 return [state run [subst -nocommands -nobackslashes {
1503 SELECT
1504 DISTINCT L.name
1505 FROM tag T, symbol L
1506 WHERE T.tid in $theset -- Restrict to tags of interest
1507 AND L.sid = T.lod -- Get lod symbol of tag
1508 }]]
1509 }
1510 }
1511
1512 # # ## ### ##### ######## ############# #####################
1513 ## Helper singleton. Commands for branch symbol changesets.
@@ -1640,22 +1744,22 @@
1640 }]]
1641 return
1642 }
1643
1644 # result = symbol name
1645 typemethod cs_lod {branches} {
1646 # Determines the name of the symbol which is the line of
1647 # development for the branches in a changeset.
1648
1649 set theset ('[join $branches {','}]')
1650 return [state run [subst -nocommands -nobackslashes {
1651 SELECT
1652 DISTINCT L.name
1653 FROM branch B, symbol L
1654 WHERE B.bid in $theset -- Restrict to branches of interest
1655 AND L.sid = B.lod -- Get lod symbol of branch
1656 }]]
1657 }
1658
1659 typemethod limits {branches} {
1660 # Notes. This method exists only for branches. It is needed to
1661 # get detailed information about a backward branch. It does
1662
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -89,11 +89,11 @@
89 append str "$mytype ${myid}${detail}>"
90 return $str
91 }
92
93 method lod {} {
94 return [$mytypeobj cs_lod $mysrcid $myitems]
95 }
96
97 method id {} { return $myid }
98 method items {} { return $mytitems }
99 method data {} { return [list $myproject $mytype $mysrcid] }
@@ -261,60 +261,148 @@
261 # - The parent changeset, if any. If there is no parent fossil
262 # will use the empty base revision as parent.
263 #
264 # - List of the file revisions in the changeset.
265
 
 
266 # We derive the lod information directly from the revisions of
267 # the changeset, as the branch part of the meta data (s.a.) is
268 # outdated since pass FilterSymbols. See the method 'run' in
269 # file "c2f_pfiltersym.tcl" for more commentary on this.
270
271 set lodname [$self lod]
272
273 log write 2 csets {Importing changeset [$self str] on $lodname}
274
275 if {[$mytypeobj istag]} {
276 # Handle tags. They appear immediately after the revision
277 # they are attached to (*). We can assume that the
278 # workspace for the relevant line of development
279 # exists. We retrieve it, then the uuid of the last
280 # revision entered into it, then tag this revision.
281
282 # (*) Immediately in terms of the relevant line of
283 # development. Revisions on other lines may come in
284 # between, but they do not matter to that.
285
286 set lws [Getworkspace $rstate $lodname $myproject 0]
287 set uuid [lindex [$lws getid] 1]
288
289 $repository tag $uuid [state one {
290 SELECT S.name
291 FROM symbol S
292 WHERE S.sid = $mysrcid
293 }]
294
295 } elseif {[$mytypeobj isbranch]} {
296
297 # Handle branches. They appear immediately after the
298 # revision they are spawned from (*). We can assume that
299 # the workspace for the relevant line of development
300 # exists.
301
302 # We retrieve it, then the uuid of the last revision
303 # entered into it. That revision is tagged as the root of
304 # the branch (**). A new workspace for the branch is
305 # created as well, for the future revisions of the new
306 # line of development.
307
308 # An exception is made of the non-trunk default branch,
309 # aka vendor branch. This lod has to have a workspace not
310 # inherited from anything else. It has no root either, so
311 # tagging is out as well.
312
313 # (*) Immediately in terms of the relevant line of
314 # development. Revisions on other lines may come in
315 # between, but they do not matter to that.
316
317 # (**) Tagging the parent revision of the branch as its
318 # root is done to let us know about the existence of
319 # the branch even if it has no revisions committed to
320 # it, and thus no regular branch tag anywhere else.
321 # The name of the tag is the name for the lod, with
322 # the suffix '-root' appended to it.
323
324 # LOD is self symbol of branch, not parent
325 set lodname [state one {
326 SELECT S.name
327 FROM symbol S
328 WHERE S.sid = $mysrcid
329 }]
330
331 if {![$rstate has :trunk:]} {
332 # No trunk implies default branch. Just create the
333 # proper workspace.
334 Getworkspace $rstate $lodname $myproject 1
335 } else {
336 # Non-default branch. Need workspace, and tag parent
337 # revision.
338
339 set lws [Getworkspace $rstate $lodname $myproject 0]
340 set uuid [lindex [$lws getid] 1]
341
342 $repository tag $uuid ${lodname}-root
343 }
344 } else {
345 # Revision changeset.
346
347 struct::list assign [$myproject getmeta $mysrcid] __ __ user message
348
349 # Perform the import. As part of that we determine the
350 # parent we need, and convert the list of items in the
351 # changeset into uuids and printable data.
352
353 struct::list assign [Getisdefault $myitems] \
354 isdefault lastdefaultontrunk
355
356 log write 8 csets {LOD '$lodname'}
357 log write 8 csets { def? $isdefault}
358 log write 8 csets { last? $lastdefaultontrunk}
359
360 set lws [Getworkspace $rstate $lodname $myproject $isdefault]
361 $lws add [Getrevisioninfo $myitems]
362
363 struct::list assign \
364 [$repository importrevision [$self str] \
365 $user $message $date \
366 [lindex [$lws getid] 0] [$lws get]] \
367 rid uuid
368
369 if {[$lws ticks] == 1} {
370 # First commit on this line of development. Set our
371 # own name as a propagating tag. And if the LOD has a
372 # parent we have to prevent the propagation of that
373 # tag into this new line.
374
375 set plws [$lws parent]
376 if {$plws ne ""} {
377 $repository branchcancel $uuid [$plws name]
378 }
379 $repository branchmark $uuid [$lws name]
380 }
381
382 # Remember the imported changeset in the state, under our
383 # LOD. And if it is the last trunk changeset on the vendor
384 # branch then the revision is also the actual root of the
385 # :trunk:, so we remember it as such in the state. However
386 # if the trunk already exists then the changeset cannot be
387 # on it any more. This indicates weirdness in the setup of
388 # the vendor branch, but one we can work around.
389
390 $lws defid [list $rid $uuid]
391 if {$lastdefaultontrunk} {
392 log write 2 csets {This cset is the last on the NTDB, set the trunk workspace up}
393
394 if {[$rstate has :trunk:]} {
395 log write 2 csets {Multiple changesets declared to be the last trunk changeset on the vendor-branch}
396 } else {
397 $rstate new :trunk: [$lws name]
398 }
399 }
400 }
401
402 log write 2 csets { }
403 log write 2 csets { }
 
 
 
 
404 return
405 }
406
407 proc Getrevisioninfo {revisions} {
408 set theset ('[join $revisions {','}]')
@@ -372,15 +460,21 @@
460 # as well, making it inherit the state of the last
461 # trunk-changeset on the vendor-branch.
462
463 if {$isdefault} {
464 if {![$rstate has ":vendor:"]} {
465 # Create the vendor branch if not present already. We
466 # use the actual name for the lod, and additional make
467 # it accessible under an internal name (:vendor:) so
468 # that we can merge to it later, should it become
469 # necessary. See the other branch below.
470 $rstate new $lodname
471 $rstate dup :vendor: <-- $lodname
472 } else {
473 # Merge the new symbol to the vendor branch
474 $rstate dup $lodname <-- :vendor:
475 }
 
 
476 return [$rstate get $lodname]
477 }
478
479 if {$lodname eq ":trunk:"} {
480 return [$rstate new $lodname]
@@ -573,21 +667,21 @@
667 # the names in the table 'cstype'
668 # in sync with the names of the
669 # helper singletons.
670
671 typemethod inorder {projectid} {
672 # Return all changesets (object references) for the specified
673 # project, in the order given to them by the sort passes. Both
674 # the filtering by project and the sorting by time make the
675 # use of 'project::rev rev' impossible.
676
677 set res {}
678 state foreachrow {
679 SELECT C.cid AS xcid,
680 T.date AS cdate
681 FROM changeset C, cstimestamp T
682 WHERE C.pid = $projectid -- limit to changesets in project
 
683 AND T.cid = C.cid -- get ordering information
684 ORDER BY T.date -- sort into commit order
685 } {
686 lappend res $myidmap($xcid) $cdate
687 }
@@ -1420,16 +1514,26 @@
1514 AND B.root = R.rid -- Select branches attached to them
1515 AND CI.iid = B.bid -- Select all changesets
1516 AND C.cid = CI.cid -- containing the branches
1517 AND C.type = 2 -- which are branch changesets
1518 }]]
1519
1520 # Regarding rev -> branch|tag, we could consider looking at
1521 # the symbol of the branch|tag, its lod-symbol, and the
1522 # revisions on that lod, but don't. Because it is not exact
1523 # enough, the branch|tag would depend on revisions coming
1524 # after its creation on the parental lod.
1525 }
1526
1527 # result = symbol name
1528 typemethod cs_lod {metaid revisions} {
1529 # Determines the name of the symbol which is the line of
1530 # development for the revisions in a changeset. The
1531 # information in the meta data referenced by the source metaid
1532 # is out of date by the time we come here (since pass
1533 # FilterSymbols), so it cannot be used. See the method 'run'
1534 # in file "c2f_pfiltersym.tcl" for more commentary on this.
1535
1536 set theset ('[join $revisions {','}]')
1537 return [state run [subst -nocommands -nobackslashes {
1538 SELECT
1539 DISTINCT L.name
@@ -1492,22 +1596,22 @@
1596 # Tags have no successors.
1597 return
1598 }
1599
1600 # result = symbol name
1601 typemethod cs_lod {sid tags} {
1602 # Determines the name of the symbol which is the line of
1603 # development for the tags in a changeset. Comes directly from
1604 # the symbol which is the changeset's source and its prefered
1605 # parent.
1606
1607 return [state run {
1608 SELECT P.name
1609 FROM preferedparent SP, symbol P
1610 WHERE SP.sid = $sid
1611 AND P.sid = SP.pid
1612 }]
1613 }
1614 }
1615
1616 # # ## ### ##### ######## ############# #####################
1617 ## Helper singleton. Commands for branch symbol changesets.
@@ -1640,22 +1744,22 @@
1744 }]]
1745 return
1746 }
1747
1748 # result = symbol name
1749 typemethod cs_lod {sid branches} {
1750 # Determines the name of the symbol which is the line of
1751 # development for the branches in a changeset. Comes directly
1752 # from the symbol which is the changeset's source and its
1753 # prefered parent.
1754
1755 return [state run {
1756 SELECT P.name
1757 FROM preferedparent SP, symbol P
1758 WHERE SP.sid = $sid
1759 AND P.sid = SP.pid
1760 }]
1761 }
1762
1763 typemethod limits {branches} {
1764 # Notes. This method exists only for branches. It is needed to
1765 # get detailed information about a backward branch. It does
1766
--- tools/cvs2fossil/lib/c2f_project.tcl
+++ tools/cvs2fossil/lib/c2f_project.tcl
@@ -157,11 +157,11 @@
157157
}
158158
}
159159
return
160160
}
161161
162
- method revisionsinorder {} {
162
+ method changesetsinorder {} {
163163
return [rev inorder $myid]
164164
}
165165
166166
delegate method getmeta to myrepository
167167
168168
--- tools/cvs2fossil/lib/c2f_project.tcl
+++ tools/cvs2fossil/lib/c2f_project.tcl
@@ -157,11 +157,11 @@
157 }
158 }
159 return
160 }
161
162 method revisionsinorder {} {
163 return [rev inorder $myid]
164 }
165
166 delegate method getmeta to myrepository
167
168
--- tools/cvs2fossil/lib/c2f_project.tcl
+++ tools/cvs2fossil/lib/c2f_project.tcl
@@ -157,11 +157,11 @@
157 }
158 }
159 return
160 }
161
162 method changesetsinorder {} {
163 return [rev inorder $myid]
164 }
165
166 delegate method getmeta to myrepository
167
168

Keyboard Shortcuts

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