WordPress / grunt-patch-wordpress

Patch Trac based projects
MIT License
50 stars 15 forks source link

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

Open richardtape opened 8 years ago

richardtape commented 8 years ago

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?

aaronjorbin commented 8 years ago

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

karmatosed commented 8 years ago

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.

joemcgill commented 7 years ago

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

aaronjorbin commented 7 years ago

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 notifications@github.com 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 .

joemcgill commented 7 years ago

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

ntwb commented 7 years ago

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.