feat: add repository migration helper#58
Draft
ehennestad wants to merge 3 commits into
Draft
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new repository migration utility to convert an existing MATLAB repo into the MatBox-compatible src/, tests/, tools/ layout, along with a focused unit test suite to validate core migration behaviors.
Changes:
- Introduces
matbox.repo.migrateToMatBoxRepowith dry-run planning, overwrite protection,.gitignoremerging, and template-based scaffolding. - Adds unit tests covering dry-run non-modification, layout creation, destination protection, requirements preservation, and git-aware moves.
- Adds minimal template-repo scaffolding in tests to exercise workflow and helper copying.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
code/+matbox/+repo/migrateToMatBoxRepo.m |
New migration helper that plans/applies filesystem and template operations to create a MatBox-style repository layout. |
tools/tests/+matboxtools/+unittest/RepoMigrationTest.m |
New unit tests validating key migration behaviors (dry-run, layout creation, protections, git move behavior). |
Comment on lines
+226
to
+231
| runSystemCommand("git", ["-C", repoRoot, "mv", source, destination]) | ||
| else | ||
| movefile(source, destination) | ||
| end | ||
| end | ||
|
|
Comment on lines
+416
to
+427
| [sourceParent, ~] = fileparts(operations.Destination(index)); | ||
| [~, packageName] = fileparts(sourceParent); | ||
| namespace = extractAfter(string(packageName), "+"); | ||
|
|
||
| text = strrep(text, "{{ cookiecutter.namespace_name }}", "{{cookiecutter.namespace_name}}"); | ||
| text = strrep(text, "{{ cookiecutter.toolbox_name }}", "{{cookiecutter.toolbox_name}}"); | ||
| text = strrep(text, "{{ cookiecutter.namespace_name | upper}}", "{{cookiecutter.namespace_name | upper}}"); | ||
| text = strrep(text, "{{cookiecutter.namespace_name}}", char(namespace)); | ||
| text = strrep(text, "{{cookiecutter.namespace_name | upper}}", char(upper(namespace))); | ||
| text = strrep(text, "{{cookiecutter.toolbox_name}}", char(namespace)); | ||
| end | ||
|
|
Comment on lines
+139
to
+143
| if options.CreateNamespaceUtilities | ||
| namespacePackageFolder = fullfile(repoRoot, "src", options.SourceFolder, "+" + options.Namespace); | ||
| operations = addOperation(operations, "mkdir", "", namespacePackageFolder, "", ... | ||
| "Create source namespace utilities folder"); | ||
| operations = addOperation(operations, "copy-render", templateFile(options.TemplateRepo, ... |
| end | ||
|
|
||
| function writeTextFile(filePath, text) | ||
| fid = fopen(filePath, "w"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a MatBox repository migration helper for converting existing MATLAB repositories to the src/tests/tools layout used by MatBox-compatible toolbox repositories.
Details
matbox.repo.migrateToMatBoxRepowith dry-run planning by default.git mvfor source moves when the target repository is under git..gitignorespacing.