grunt-patch-wordpress icon indicating copy to clipboard operation
grunt-patch-wordpress copied to clipboard

(probably dumb) Question: Is there a task to remove patches after they've been applied

Open richardtape opened this issue 9 years ago • 6 comments

Normally I'd do something like patch -p0 -R < patch_file_path.patch but if I'm using the (really rather brilliant) grunt patch:<some_url> then I don't have the file locally in order to undo that... do I?

richardtape avatar Apr 26 '16 18:04 richardtape

There isn't at this time, but I think that it could be a good enhancement.

aaronjorbin avatar Apr 26 '16 18:04 aaronjorbin

I would love to see removing the patch as an enhancement. I am using grunt patch a lot and having the reverse would be amazing.

karmatosed avatar Sep 04 '16 10:09 karmatosed

I'd be into this. @aaronjorbin could we automatically create a new diff on the working tree and then do something like @richardtape suggests?

joemcgill avatar Oct 19 '16 17:10 joemcgill

We have the code from patch-upload for creating a diff. That could be used.

http://aaron.jorb.in twitter: twitter.com/aaronjorbin

On Wed, Oct 19, 2016 at 1:57 PM, Joe McGill [email protected] wrote:

I'd be into this. @aaronjorbin https://github.com/aaronjorbin could we automatically create a new diff on the working tree and then do something like @richardtape https://github.com/richardtape suggests?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aaronjorbin/grunt-patch-wordpress/issues/36#issuecomment-254891188, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmAB7Q6jhz6T5IOxvl1SirMEusZNZOHks5q1loRgaJpZM4IQNfK .

aaronjorbin avatar Oct 19 '16 18:10 aaronjorbin

Right. We would also need to detect and remove any *.php.orig files that were generated during the patching process.

joemcgill avatar Oct 19 '16 18:10 joemcgill

I just discovered the following by accident, rerun the task to reverse the patch 💥

For example, grunt patch:38672 to apply the patch, and grunt patch:38672 to remove the patch, when prompted with Reversed (or previously applied) patch detected! Assume -R? [n] hit the y key

develop.svn.wordpress.org  trunk  $  grunt patch:38672
Running "patch:38672" (patch) task
? Please select a patch to apply 38672.extensibility.2.diff​ (8.9 KB) - added by westonruter 26 hours ago.
patching file src/wp-includes/customize/class-wp-customize-custom-css-setting.php
patching file src/wp-includes/js/customize-preview.js
patching file src/wp-includes/theme.php

Done, without errors.
develop.svn.wordpress.org  trunk  3  $  svn st
M       src/wp-includes/customize/class-wp-customize-custom-css-setting.php
M       src/wp-includes/js/customize-preview.js
M       src/wp-includes/theme.php
X       tests/phpunit/data/plugins/wordpress-importer
?       yarn.lock

Performing status on external item at 'tests/phpunit/data/plugins/wordpress-importer':
develop.svn.wordpress.org  trunk  3  $  grunt patch:38672
Running "patch:38672" (patch) task
? Please select a patch to apply 38672.extensibility.2.diff​ (8.9 KB) - added by westonruter 26 hours ago.
patching file src/wp-includes/customize/class-wp-customize-custom-css-setting.php
Reversed (or previously applied) patch detected!  Assume -R? [n] y
patching file src/wp-includes/js/customize-preview.js
Reversed (or previously applied) patch detected!  Assume -R? [n] y
patching file src/wp-includes/theme.php
Reversed (or previously applied) patch detected!  Assume -R? [n] y

Done, without errors.
develop.svn.wordpress.org  trunk  $  svn st
?       src/wp-includes/customize/class-wp-customize-custom-css-setting.php.orig
?       src/wp-includes/js/customize-preview.js.orig
?       src/wp-includes/theme.php.orig
X       tests/phpunit/data/plugins/wordpress-importer
?       yarn.lock

Performing status on external item at 'tests/phpunit/data/plugins/wordpress-importer':
develop.svn.wordpress.org  trunk  $  svn diff
develop.svn.wordpress.org  trunk  $                    

As pointed out above the *.php.orig files remain, they'll be ignored once #WP38727 is in though.

ntwb avatar Nov 12 '16 22:11 ntwb