Pharo utility to migrate FileTree repositories to Tonel
- git installed in the system and available in
PATH
- Pharo 6+ (at least 60518)
Metacello new
baseline: 'TonelMigration';
repository: 'github://peteruhnak/tonel-migration/repository';
load.
"in Pharo"
sourceRepository := IceRepository registry detect: [ :each | each name = 'tonel-migration-demo' ];
targetLocation := FileLocator home asFileReference / 'prog' / 'tonel-migration' / 'migration-target'.
"if the location doesn't exist"
targetLocation ensureCreateDirectory.
repo := IceLibgitLocalRepository newRepositoryAt: targetLocation subdirectory: sourceRepository subdirectory.
repo init.
TonelMigrationRunner new
sourceRepository: sourceRepository;
targetFile: targetLocation / 'import.txt';
migrate
# in terminal
cd ~/prog/tonel-migration/migration-target
# import.txt is the file that you've created earlier
git fast-import < import.txt
# fast-import doesn't change the working directory, so we need to update it
git reset --hard master
You should see the changes, and git log
should show you the entire history.
Forgetting all changes in the history and going back to previous state. Useful if the migration is botched and you want to rollback all changes.
$ git reset --hard SHA