Problem/Motivation
After initiating Varbase patches and setting a rule to not use any merge request patches, I have implemented a Drush command to replace any merge request patch with a local patch.
Proposed resolution
Root `composer.json` file.
Name: varbase:composer:cleanup:patches
Aliases: var-ccup
Description: This command detects any merge request patches, downloads them to the local patches folder with a timestamp, and updates the root `composer.json` file to use the timestamped local patch file.
Example:
./bin/drush varbase:composer:cleanup:patches
or
./bin/drush var-ccup
External `patches-file` json file.
Name: varbase:composer:cleanup:patches-file
Aliases: var-ccupf
Description: This command detects any merge request patches, downloads them to the local patches folder with a timestamp, and updates the `patches-file JSON` file to use the timestamped local patch file.
Example:
./bin/drush varbase:composer:cleanup:patches-file
or
./bin/drush var-ccupf
Remaining tasks
- ✅ File an issue about this project
- ✅ Addition/Change/Update/Fix to this project
- ✅ Testing to ensure no regression
- ➖ Automated unit/functional testing coverage
- ✅ Developer Documentation support on feature change/addition
Added to Varbase Docs - under the Varbase Patches section
Drush Command to Clean up Any Merge Request Patches
- ➖ User Guide Documentation support on feature change/addition
- ➖ UX/UI designer responsibilities
- ➖ Accessibility and Readability
- ✅ Code review from 1 Varbase core team member
- ✅ Full testing and approval
- ✅ Credit contributors
- ✅ Review with the product owner
- ✅ Update Release Notes and Update Helper on new feature change/addition
- ✅ Release varbase-10.0.0, varbase_core-10.0.22, varbase-9.1.4, varbase_core-9.1.35
Varbase update type
- ✅ No Update
- ➖ Optional Update
- ➖ Forced Update
- ➖ Forced Update if Unchanged
User interface changes
- N/A
API changes
- N/A
Data model changes
- N/A
Release notes snippet
- Issue #3448429 by abu-zakham: Added
varbase:composer:cleanup:patchesdrush command to clean upcomposer.jsonfrom any merge request patches
Added to Varbase Docs - under the Varbase Patches section
Drush Command to Clean up Any Merge Request Patches
Issue fork varbase_core-3448429
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
abu-zakham commentedComment #5
rajab natshahComment #6
rajab natshahComment #7
rajab natshahComment #8
rajab natshah1. Let us wrap the command code with try catch
2. Let use the
\Drupal::logger('Varbase')to log the fixes3. Let use drush logger for std output from drush
3. Maybe check if the folder
patchesis in the system ( if the chmod, chown, was not right )4. Give a warning if the Merge request was added twice
./bin/drush varbase:composer-clean-uporlando drush varbase:composer-clean-upfixed it5. Maybe more scenarios.
Comment #9
rajab natshahMaybe we could add a flag or other command to only check if the root
composer.jsonhas"/-/merge_requests/"Comment #10
rajab natshahComment #13
rajab natshahReviewed the code and merged
Optimizing the idea to follow with
Storage of Local Patches Branch
Examples of Names for Local Patch files
1. Grep on
"/-/merge_requests"not only"merge_requests", as it may be in the file name of a a patch.2. Add Project name, date , issue id and the MR number.
$project_name--$date--$issue_id--$mr_id.patchpatchesfolder.Comment #14
rajab natshahBetter to print out the list of clean patches ( better drush messaging )
Comment #15
rajab natshahComment #19
rajab natshahComment #20
rajab natshahComment #21
rajab natshahComment #22
rajab natshahComment #25
rajab natshahComment #26
rajab natshahComment #27
rajab natshahComment #28
rajab natshahComment #29
rajab natshahComment #30
rajab natshahComment #31
rajab natshah✅ Released varbase_core-9.1.35
Comment #32
rajab natshahComment #33
rajab natshah✅ Released varbase_core-10.0.22
Comment #34
rajab natshahComment #35
rajab natshahComment #36
rajab natshahComment #38
rajab natshah✅ Release varbase-10.0.0
Comment #39
rajab natshah✅ Released varbase-9.1.4