From 74fa8bb811413f0e689ec03be1302f66c6b78ae2 Mon Sep 17 00:00:00 2001 From: Esteban Lorenzano Date: Fri, 6 Oct 2017 18:46:54 +0200 Subject: [PATCH] add migration instructions --- MigrateFromFileTree.md | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 MigrateFromFileTree.md diff --git a/MigrateFromFileTree.md b/MigrateFromFileTree.md new file mode 100644 index 0000000..2f9a75f --- /dev/null +++ b/MigrateFromFileTree.md @@ -0,0 +1,44 @@ +Migrate from FileTree to Tonel +=== + +I prepared this small script to drive your migration: + +```Smalltalk +locationDir := 'path/to/your/repo' asFileReference. +subDir := 'your-source-dir-or-empty'. +sourceDir := locationDir. +subDir + ifNotNil: [ + subDirWithDelim := subDir, '/'. + sourceDir := sourceDir / subDir ] + ifNil: [ + subDirWithDelim := '' ]. + +repo := IceRepositoryCreator new + location: locationDir; + subdirectory: subDir; + createRepository. + +"branch if you want to perform the migration on separated place (you +can later do a PR)" +repo createBranch: 'migrate-sources-to-tonel'. + +commit := repo branch lastCommit. +repo savedPackages do: [ :each | | filetreePackage | + TonelWriter fileOut: (commit versionFor: each) on: sourceDir. + filetreePackage := IceLibgitFiletreeWriter directoryNameFor: each. + (sourceDir / filetreePackage) ensureDeleteAll. + repo addFilesToIndex: { + subDirWithDelim, (IceLibgitTonelWriter directoryNameFor: each). + subDirWithDelim, (IceLibgitFiletreeWriter directoryNameFor: each). } ]. + +repo addProperties: (IceRepositoryProperties fromDictionary: { #format -> #tonel } asDictionary). + +repo + commitIndexWithMessage: 'sources migrated' + andParents: { commit }. + +repo push. +``` + +*Please note that is not possible to migrate history from FileTree to Tonel. This is because FileTree is file-per-method and Tonel is File-Per-Class, so no conversion can be made (at least that I can think of).*