phetsims / perennial

Maintenance tools that won't change with different versions of chipper checked out
MIT License
2 stars 5 forks source link

Maintenance bug when applying patch to your own release #338

Open zepumph opened 9 months ago

zepumph commented 9 months ago

I recently was tired and wrote this maintenance code (as part of a larger MR patch in https://github.com/phetsims/build-a-nucleus/issues/215). It broke things!

m.reset()
m.createPatch( 'build-a-nucleus', 'https://github.com/phetsims/build-a-nucleus/issues/215' );
m.addNeededPatch( 'build-a-nucleus' ,'1.1', 'build-a-nucleus' );
m.addPatchSHA( 'build-a-nucleus', '367a00e015ea94fb29797e5799f294c2cead7e48' );
m.applyPatches();
m.updateDependencies();  // <--- created a build-a-nucleus-1.1 branch in build-a-nucleus

It ended up creating a build-a-nucleus-1.1 branch. That makes me sad, and seems like an easy thing to improve upon, but I couldn't really crack it when looking at the code. @jonathanolson could you help me brainstorm even a spot for an assertion like "You can't patch the branch of a release branch that you have as a needed patch".

jonathanolson commented 9 months ago

It looks like it would need to be patched in a few places to avoid this type of thing.

zepumph commented 9 months ago

Is there a quick and dirty spot where we could fail out just so that we know it isn't a supported feature?

zepumph commented 9 months ago

Or better yet, could it just become a ternary when it comes to figuring out the branch name (untested made up code):

get branchName( repo ) { return this.repo === repo? this.branch : '${repo}-${this.branch}'; }