"{ Package: 'stx:libsvn' }"
"{ NameSpace: SVN }"
CVSTask subclass:#ImportFromCVSTask
instanceVariableNames:'svnRoot'
classVariableNames:'SVNRoot'
poolDictionaries:''
category:'SVN-Tasks'
!
!ImportFromCVSTask class methodsFor:'accessing'!
svnRoot
^SVNRoot
"
self svnRoot
self svnRoot: '/home/janfrog/Projects/SmalltalkX/sandbox/svn'
"
"Created: / 25-05-2009 / 21:06:59 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 29-05-2009 / 16:47:01 / Jan Vrany <vranyj1@fel.cvut.cz>"
!
svnRoot: aString
SVNRoot := aString
"
self svnRoot
self svnRoot: '/home/janfrog/Projects/SmalltalkX/sandbox/svn'
"
"Created: / 25-05-2009 / 21:07:14 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 26-05-2009 / 18:26:37 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
!ImportFromCVSTask class methodsFor:'examples'!
migrate_eXept_repository
self import:#( #'stx:libbasic'
#'stx:libbasic2'
#'stx:libbasic3'
#'stx:libcomp' )
logOn:'/tmp/migrate_eXept.log'
"
SVN::CVSMigrationTool migrate_eXept_repository"
"Created: / 26-05-2009 / 17:34:08 / Jan Vrany <vranyj1@fel.cvut.cz>"
!
migrate_eXept_repository_tinytalk
self import:#( #'stx:libbasic'
#'stx:libbasic2'
#'stx:libbasic3'
#'stx:libcomp'
#'stx:projects/tinytalk' )
logOn:'/tmp/migrate_eXept.log'
"
SVN::CVSMigrationTool migrate_eXept_repository_tinytalk"
"Created: / 27-05-2009 / 10:08:30 / Jan Vrany <vranyj1@fel.cvut.cz>"
!
migrate_stx_libbasic2
self import:#'stx:libbasic2'
"
SVN::CVSMigrationTool migrate_stx_libbasic2"
"Created: / 25-05-2009 / 19:41:52 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 27-05-2009 / 10:09:43 / Jan Vrany <vranyj1@fel.cvut.cz>"
!
migrate_stx_libtool
self import:#'stx:libbasic'
"
SVN::CVSMigrationTool migrate_stx_libtool"
"Created: / 25-05-2009 / 22:12:53 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 26-05-2009 / 18:22:16 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
!ImportFromCVSTask class methodsFor:'migration'!
import:pkgs
^ self doFor:pkgs
"Created: / 28-05-2009 / 11:08:54 / Jan Vrany <vranyj1@fel.cvut.cz>"
!
import:pkgs logOn:log
^ self doFor:pkgs logOn:log
"Created: / 28-05-2009 / 11:09:06 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
!ImportFromCVSTask methodsFor:'executing'!
do
self notify:'Importing package ' , package.
self
doChecks;
doPrepareRepositories;
doCVS2SVN;
doSVNFixPackageContent;
doCleanup.
self notify:'Package ' , package , ' imported'
"Created: / 29-05-2009 / 18:05:01 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 31-05-2009 / 10:17:18 / Jan Vrany <vranyj1@fel.cvut.cz>"
!
doCVS2SVN
| cvs2svn |
self notify: 'Importing CVS repository into SVN'.
(svnRoot construct:packageDir) directory recursiveMakeDirectory.
cvs2svn := OSProcess new
executable: '/usr/bin/cvs2svn';
arguments: {
'--quiet'. '--quiet'.
"/'--use-cvs'.
'--use-rcs'.
'--encoding=ascii'.
'--encoding=utf8'.
'--encoding=latin_1'.
'--encoding=iso8859_2'.
'--tmpdir=' , (tmpDir construct:'cvs2svn-tmp') pathName.
'--svnrepos'. (svnRoot construct: packageDir) pathName.
(cvsRoot construct: packageDir) pathName.
};
stdout: transcript;
stderr: transcript.
cvs2svn execute.
self
assert: cvs2svn exitValue = 0
message: 'cvs2svn failed to finish properly. Check transcript'.
"Created: / 29-05-2009 / 18:05:42 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 19-08-2009 / 11:48:19 / Jan Vrany <vranyj1@fel.cvut.cz>"
!
doChecks
self notify: 'Checking repositories'.
self
assert:cvsRoot exists
message:'cvsRoot does not exist';
assert:(cvsRoot construct:'CVSROOT') exists
message:'cvsRoot seems not to be a valid CVS root (no CVSROOT directory)';
assert:(cvsRoot construct:packageDir) exists
message:'cvsRoot seems does not contain given package';
assert:svnRoot exists
message:'svnRoot does not exist';
assert:(svnRoot construct:packageDir) exists not
message:'SVN repository already exists in svnRoot'
"Created: / 29-05-2009 / 17:18:57 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 30-05-2009 / 16:03:29 / Jan Vrany <vranyj1@fel.cvut.cz>"
!
doPrepareRepositories
self doCVSRemoveDuplicateCommaVFilesInAttic
"Created: / 29-05-2009 / 18:02:49 / Jan Vrany <vranyj1@fel.cvut.cz>"
!
doSVNFixPackageContent
self
doSVNCheckout;
doFixPackageContentIn: workingCopy path;
doSVNSetSvnEolStylePropertyFor: #( '*.st' );
doSVNSetSvnKeywordPropertyFor: #( '*.st' );
doSVNCommit
"Created: / 29-05-2009 / 18:06:35 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 19-08-2009 / 11:26:38 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
!ImportFromCVSTask methodsFor:'executing - private'!
doCVSRemoveDuplicateCommaVFilesInAttic
self notify: 'Removing duplicate *,v files in Attic'.
self doRemoveDuplicateCommaVFilesInAtticIn:(cvsRoot construct:packageDir).
"Created: / 25-05-2009 / 22:28:16 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 30-05-2009 / 16:04:36 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
!ImportFromCVSTask methodsFor:'initialization'!
initialize
super initialize.
svnRoot := self class svnRoot asFilename.
"Created: / 28-05-2009 / 09:06:08 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
!ImportFromCVSTask methodsFor:'private'!
removeFiles: filenames
(DeleteCommand new)
workingCopy: workingCopy;
paths: filenames;
execute
"Created: / 30-05-2009 / 16:09:50 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 19-08-2009 / 11:28:06 / Jan Vrany <vranyj1@fel.cvut.cz>"
!
renameFile: oldFilename to: newFilename
(MoveCommand new)
workingCopy: workingCopy;
src: oldFilename pathName;
dst: newFilename pathName;
execute.
"Created: / 30-05-2009 / 16:09:10 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 19-08-2009 / 11:28:13 / Jan Vrany <vranyj1@fel.cvut.cz>"
!
svnBranchPath
"raise an error: must be redefined in concrete subclass(es)"
^'/trunk'
"Modified: / 19-08-2009 / 11:18:34 / Jan Vrany <vranyj1@fel.cvut.cz>"
!
svnCommitMessage
^ 'Manufactured by SVN::ImportFromCVSTask to fix repository layout'
"Modified: / 30-05-2009 / 16:15:57 / Jan Vrany <vranyj1@fel.cvut.cz>"
!
svnRepositoryUrl
^ 'file://' , (svnRoot asAbsoluteFilename construct:packageDir) pathName
"Modified: / 19-08-2009 / 11:09:25 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
!ImportFromCVSTask class methodsFor:'documentation'!
version
^ '$Header$'
!
version_CVS
^ '$Header$'
!
version_SVN
^'§Id: SVN__ImportFromCVSTask.st 110 2009-08-19 13:21:10Z vranyj1 §'
! !