I wrote some commands to help module maintainers.




drush help patch

Applies the given patch to the affected module.



Examples:

 0                                         drush patch

                                           http://example.com/file.patch

 1                                         drush patch

                                           http://drupal.org/node/69696969



Arguments:

 url                                       URL to the patch. Can be a HTTP URL

                                           to the actual patch file or a d.o

                                           node


Reverts the changes of the given patch.



Examples:

 0                                         drush unpatch

                                           http://example.com/file.patch

 1                                         drush unpatch

                                           http://drupal.org/node/69696969



Arguments:

 url                                       URL to the patch. Can be a HTTP URL

                                           to the actual patch file or a d.o

                                           node


Applies the given patch to the affected module and run the relevant simpletest

tests, then revert the files.



Examples:

 0                                         drush patchtest

                                           http://example.com/file.patch

 1                                         drush patchtest --affected

                                           module1,module2

                                           http://example.com/file.patch



Arguments:

 url                                       URL to the patch. Can be a HTTP URL

                                           to the actual patch file or a d.o

                                           node



Options:

 --affected                                Comma separated names of affected

                                           modules. Tests for these modules

                                           will be executed. Use --affected=all

                                           to run all the tests on the site.

 --force                                   Run the tests even if the patching

                                           is unsuccessful.


Executes the simpletest test for the given module only.



Examples:

 0                                         drush moduletest user

 1                                         drush moduletest simpletest

 2                                         drush moduletest all



Arguments:

 module                                    Name of the module. If "all" is

                                           given, all of the tests will be

                                           executed



Options:

 --verbose                                 Show the full output of run-test.sh,

                                           not only the failed tests.

The help of the commands are self-explaining.

Comments

jonhattan’s picture

I just take a quick look to the code. You should change the calls to `module_rebuild_cache` by `drush_get_modules`, that has been recently introduced in HEAD for D7 compatibility.

aron novak’s picture

StatusFileSize
new3.41 KB

jonhattan: thank you for the notice, it's great that drush provides cross-version compabitility.

New .inc is attached.

moshe weitzman’s picture

Wow, this is really really nice. I have some minor drush API type feedback, but I think I will just play with this and see how it goes. Meanwhile, would be great of folks reviewed this.

Would it be helpful if some form of #580530: Command to run simpletests were in drush? Might be better than relying on run-tests.sh.

moshe weitzman’s picture

Status: Needs review » Needs work

Hmm. On first try I get:

~/htd/pr6$ drush patch http://drupal.org/files/issues/og_access_pre_render.patch
Failed to detect which module to patch.                                                        [error]

Can we make this detection code more robust? I tried running this from the sites/all/modules/og directory and the drupal root.

R-H’s picture

I get the same failed to detect module

:/var/www/pressflow/sites/all/modules/logintoboggan# drush patch http://drupal.org/files/issues/logintoboggan.module_21.patch
Failed to detect which module to patch.

greg.1.anderson’s picture

This looks good; we should revisit after drush-3.0 stable is out.

See related issue #392762: Kitten-o-matic.

greg.1.anderson’s picture

Component: Code » PM (dl, en, up ...)
Status: Needs work » Closed (duplicate)

All this and more now being worked on at http://drupal.org/node/1078108