Fossil SCM

Moved the most complex parts of pushto into their own commands.

aku 2008-01-31 05:39 trunk
Commit 3cd599cacdd9e2b09f159230e4f5f28bf5f831e7
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -407,10 +407,46 @@
407407
#
408408
# - List of the file revisions in the changeset.
409409
410410
struct::list assign [$myproject getmeta $mysrcid] __ branch user message
411411
struct::list assign $branch __ lodname
412
+
413
+ # Perform the import. As part of that convert the list of
414
+ # items in the changeset into uuids and printable data.
415
+
416
+ set uuid [Updatestate state $lodname \
417
+ [$repository importrevision [$self str] \
418
+ $user $message $date \
419
+ [Getparent state $lodname $myproject] \
420
+ [Getrevisioninfo $myitems]]]
421
+
422
+ # Remember the whole changeset / uuid mapping, for the tags.
423
+
424
+ state run {
425
+ INSERT INTO csuuid (cid, uuid)
426
+ VALUES ($myid, $uuid)
427
+ }
428
+ return
429
+ }
430
+
431
+ proc Getrevisioninfo {revisions} {
432
+ set theset ('[join $revisions {','}]')
433
+ set revisions {}
434
+ foreach {uuid fname revnr} [state run [subst -nocommands -nobackslashes {
435
+ SELECT U.uuid, F.name, R.rev
436
+ FROM revision R, revuuid U, file F
437
+ WHERE R.rid IN $theset -- All specified revisions
438
+ AND U.rid = R.rid -- get fossil uuid of revision
439
+ AND F.fid = R.fid -- get file of revision
440
+ }]] {
441
+ lappend revisions $uuid $fname $revnr
442
+ }
443
+ return $revisions
444
+ }
445
+
446
+ proc Getparent {sv lodname project} {
447
+ upvar 1 $sv state
412448
413449
# The parent is determined via the line-of-development (LOD)
414450
# information of each changeset, and the history of
415451
# imports. The last changeset committed to the same LOD is
416452
# taken as the parent of the current changeset. If the
@@ -427,54 +463,36 @@
427463
# the various possibilities of its interaction with the
428464
# trunk are not fully handled.
429465
430466
if {[info exists state($lodname)]} {
431467
# LOD exists and has already been committed to.
432
- set parent $state($lodname)
433
- } else {
434
- # LOD has not been committed to before, this is the first
435
- # time. Determine the name of the parent LOD.
436
-
437
- set plodname [[[$myproject getsymbol $lodname] parent] name]
438
-
439
- if {[info exists state($plodname)]} {
440
- # The parental LOD has been committed to, take that
441
- # last changeset as the spawnpoint for the new LOD.
442
- set parent $state($plodname)
443
- } else {
444
- # The parental LOD is not defined (yet). This LOD is
445
- # detached. We choose as our parent the automatic
446
- # empty root baseline of the target repository.
447
- set parent {}
448
- }
449
- }
450
-
451
- # Perform the import. As part of that convert the list of
452
- # items in the changeset into uuids and printable data.
453
-
454
- set theset ('[join $myitems {','}]')
455
- set uuid [$repository importrevision [$self str] \
456
- $user $message $date $parent \
457
- [state run [subst -nocommands -nobackslashes {
458
- SELECT U.uuid, F.name, R.rev
459
- FROM revision R, revuuid U, file F
460
- WHERE R.rid IN $theset -- All specified revisions
461
- AND U.rid = R.rid -- get fossil uuid of revision
462
- AND F.fid = R.fid -- get file of revision
463
- }]]]
464
-
468
+ return $state($lodname)
469
+ }
470
+
471
+ # LOD has not been committed to before, this is the first
472
+ # time. Determine the name of the parent LOD.
473
+
474
+ set lodname [[[$project getsymbol $lodname] parent] name]
475
+
476
+ if {[info exists state($lodname)]} {
477
+ # The parental LOD has been committed to, take that last
478
+ # changeset as the spawnpoint for the new LOD.
479
+ return $state($lodname)
480
+ }
481
+
482
+ # The parental LOD is not defined (yet). This LOD is
483
+ # detached. We choose as our parent the automatic empty root
484
+ # baseline of the target repository.
485
+ return {}
486
+ }
487
+
488
+ proc Updatestate {sv lodname uuid} {
465489
# Remember the imported changeset in the state, under our LOD.
466490
491
+ upvar 1 $sv state
467492
set state($lodname) $uuid
468
-
469
- # Remember the whole changeset / uuid mapping, for the tags.
470
-
471
- state run {
472
- INSERT INTO csuuid (cid, uuid)
473
- VALUES ($myid, $uuid)
474
- }
475
- return
493
+ return $uuid
476494
}
477495
478496
typemethod split {cset args} {
479497
# As part of the creation of the new changesets specified in
480498
# ARGS as sets of items, all subsets of CSET's item set, CSET
481499
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -407,10 +407,46 @@
407 #
408 # - List of the file revisions in the changeset.
409
410 struct::list assign [$myproject getmeta $mysrcid] __ branch user message
411 struct::list assign $branch __ lodname
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
412
413 # The parent is determined via the line-of-development (LOD)
414 # information of each changeset, and the history of
415 # imports. The last changeset committed to the same LOD is
416 # taken as the parent of the current changeset. If the
@@ -427,54 +463,36 @@
427 # the various possibilities of its interaction with the
428 # trunk are not fully handled.
429
430 if {[info exists state($lodname)]} {
431 # LOD exists and has already been committed to.
432 set parent $state($lodname)
433 } else {
434 # LOD has not been committed to before, this is the first
435 # time. Determine the name of the parent LOD.
436
437 set plodname [[[$myproject getsymbol $lodname] parent] name]
438
439 if {[info exists state($plodname)]} {
440 # The parental LOD has been committed to, take that
441 # last changeset as the spawnpoint for the new LOD.
442 set parent $state($plodname)
443 } else {
444 # The parental LOD is not defined (yet). This LOD is
445 # detached. We choose as our parent the automatic
446 # empty root baseline of the target repository.
447 set parent {}
448 }
449 }
450
451 # Perform the import. As part of that convert the list of
452 # items in the changeset into uuids and printable data.
453
454 set theset ('[join $myitems {','}]')
455 set uuid [$repository importrevision [$self str] \
456 $user $message $date $parent \
457 [state run [subst -nocommands -nobackslashes {
458 SELECT U.uuid, F.name, R.rev
459 FROM revision R, revuuid U, file F
460 WHERE R.rid IN $theset -- All specified revisions
461 AND U.rid = R.rid -- get fossil uuid of revision
462 AND F.fid = R.fid -- get file of revision
463 }]]]
464
465 # Remember the imported changeset in the state, under our LOD.
466
 
467 set state($lodname) $uuid
468
469 # Remember the whole changeset / uuid mapping, for the tags.
470
471 state run {
472 INSERT INTO csuuid (cid, uuid)
473 VALUES ($myid, $uuid)
474 }
475 return
476 }
477
478 typemethod split {cset args} {
479 # As part of the creation of the new changesets specified in
480 # ARGS as sets of items, all subsets of CSET's item set, CSET
481
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -407,10 +407,46 @@
407 #
408 # - List of the file revisions in the changeset.
409
410 struct::list assign [$myproject getmeta $mysrcid] __ branch user message
411 struct::list assign $branch __ lodname
412
413 # Perform the import. As part of that convert the list of
414 # items in the changeset into uuids and printable data.
415
416 set uuid [Updatestate state $lodname \
417 [$repository importrevision [$self str] \
418 $user $message $date \
419 [Getparent state $lodname $myproject] \
420 [Getrevisioninfo $myitems]]]
421
422 # Remember the whole changeset / uuid mapping, for the tags.
423
424 state run {
425 INSERT INTO csuuid (cid, uuid)
426 VALUES ($myid, $uuid)
427 }
428 return
429 }
430
431 proc Getrevisioninfo {revisions} {
432 set theset ('[join $revisions {','}]')
433 set revisions {}
434 foreach {uuid fname revnr} [state run [subst -nocommands -nobackslashes {
435 SELECT U.uuid, F.name, R.rev
436 FROM revision R, revuuid U, file F
437 WHERE R.rid IN $theset -- All specified revisions
438 AND U.rid = R.rid -- get fossil uuid of revision
439 AND F.fid = R.fid -- get file of revision
440 }]] {
441 lappend revisions $uuid $fname $revnr
442 }
443 return $revisions
444 }
445
446 proc Getparent {sv lodname project} {
447 upvar 1 $sv state
448
449 # The parent is determined via the line-of-development (LOD)
450 # information of each changeset, and the history of
451 # imports. The last changeset committed to the same LOD is
452 # taken as the parent of the current changeset. If the
@@ -427,54 +463,36 @@
463 # the various possibilities of its interaction with the
464 # trunk are not fully handled.
465
466 if {[info exists state($lodname)]} {
467 # LOD exists and has already been committed to.
468 return $state($lodname)
469 }
470
471 # LOD has not been committed to before, this is the first
472 # time. Determine the name of the parent LOD.
473
474 set lodname [[[$project getsymbol $lodname] parent] name]
475
476 if {[info exists state($lodname)]} {
477 # The parental LOD has been committed to, take that last
478 # changeset as the spawnpoint for the new LOD.
479 return $state($lodname)
480 }
481
482 # The parental LOD is not defined (yet). This LOD is
483 # detached. We choose as our parent the automatic empty root
484 # baseline of the target repository.
485 return {}
486 }
487
488 proc Updatestate {sv lodname uuid} {
 
 
 
 
 
 
 
 
 
 
 
 
489 # Remember the imported changeset in the state, under our LOD.
490
491 upvar 1 $sv state
492 set state($lodname) $uuid
493 return $uuid
 
 
 
 
 
 
 
494 }
495
496 typemethod split {cset args} {
497 # As part of the creation of the new changesets specified in
498 # ARGS as sets of items, all subsets of CSET's item set, CSET
499

Keyboard Shortcuts

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