Skip to content

Commit

Permalink
Return success for applyPatches, see #365
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid authored and zepumph committed Oct 4, 2024
1 parent 95bcdfa commit 40d81ed
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
16 changes: 12 additions & 4 deletions doc/temp/density-buoyancy-1.2-release-candidate-notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@
const Maintenance = require( '../../js/common/Maintenance.js' );
const m = Maintenance;

const setUpPatch = async ( patchName, sha, repo = 'density-buoyancy-common' ) => {
const cherryPickSHA = async ( repo, sha ) => {
const patchName = repo + sha;
await m.createPatch( repo, 'for rc.2', patchName );
await m.addPatchSHA( patchName, sha );
await m.addNeededPatch( 'density', '1.2', patchName );
await m.addNeededPatch( 'buoyancy', '1.2', patchName );
await m.addNeededPatch( 'buoyancy-basics', '1.2', patchName );

await m.applyPatches();
const success = await m.applyPatches(); // could also throw
if ( success ) {
await m.updateDependencies();
}
}

//////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -79,8 +83,12 @@
////////////////////////////////////////////////////////
// B:B explore share usageTracker https://github.com/phetsims/density-buoyancy-common/issues/397
// https://github.com/phetsims/density-buoyancy-common/commit/45dc5d2946385141b6406654f3143ab0f8e2a3df
await setUpPatch( 'exploreGrabDragUsageTracker', '45dc5d2946385141b6406654f3143ab0f8e2a3df' );
await m.updateDependencies();
// await setUpPatch( 'exploreGrabDragUsageTracker', '45dc5d2946385141b6406654f3143ab0f8e2a3df' );
// await m.updateDependencies();

////////////////////////////////////////////////////////
// https://github.com/phetsims/density-buoyancy-common/issues/405
// Avoid cascading density property changes from "hidden" fluids to the custom fluid density
// await cherryPickSHA( 'density-buoyancy-common', 'c22a525940eb520b74ef717f986c16ae83ab1183' );

} )();
5 changes: 5 additions & 0 deletions js/common/Maintenance.js
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,8 @@ module.exports = ( function() {
* @public
*/
static async applyPatches() {

let success = true;
const maintenance = Maintenance.load();
let numApplied = 0;

Expand Down Expand Up @@ -791,6 +793,7 @@ module.exports = ( function() {
break;
}
else {
success = false;
console.log( `Could not cherry-pick ${sha}` );
}
}
Expand All @@ -808,6 +811,8 @@ module.exports = ( function() {
maintenance.save();

console.log( `${numApplied} patches applied` );

return success;
}

/**
Expand Down

0 comments on commit 40d81ed

Please sign in to comment.