Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've submitted a few patches for WordPress core on Trac (one of which has been used) but every time I think about doing it I cringe because my setup for doing so is incredibly tedious.

Can someone please detail out the steps needed to submit a patch for core, and then the best way to streamline the process so it's not so tedious? I work Mac OS X and PhpStorm currently but I'm thinking a shell script might be easiest? Or maybe a PHP Script that does all the rote work?

One of the issues is I don't fully understand what I need to be starting with. Do I start with trunk? Do I have to download a new copy and add to/edit that copy with my code every time I want to create a patch?

Again, while I have done it working with SVN and patching is really outside my current skillset and I want to change that. Hoping you WordPress patching experts can come to my rescue. Thanks in advance.

UPDATE:

After @hakre's answer I figure I should add more to the question:

  • Can I create patches from older version or must I use trunk?
  • If I'm working on a project using the released version (3.0.1) can I modify it and create a patch for core or do I have to download and set up a pristine and new copy of trunk and newly make my modifications there?
  • Can I do with shell scripts so I can encode the login into the script and just run the script to recreate everything I need and/or to create the patch?
  • And what are the pitfalls?

All of these questions seem to be assumed by those who know how WordPress's SVN works and as such are always glossed over in any discussion.

share|improve this question

3 Answers 3

up vote 8 down vote accepted

The easiest way to create a patch is described here:

http://wordpress.org/download/svn/

Can I create patches from older version or must I use trunk?

You should create the patch against the same version you want it applied against.

In other words, don't expect a patch created against WP 3.0.1 to apply cleanly on WP 3.1-alpha.

If I'm working on a project using the released version (3.0.1) can I modify it and create a patch for core or do I have to download and set up a pristine and new copy of trunk and newly make my modifications there?

You don't have to set up a new installation for each new patch. You can just use svn revert to get back to a pristine copy.

Also, the database doesn't have to be clean each time. Actually, it's better if you have some modifications, to simulate a live environment.

share|improve this answer
1  
Gee, it's bloody easy to create a patch after we have our working copy: svn diff > my-patch.patch, me gusta! –  brasofilo Oct 23 '13 at 19:14

Eclipse PDT + Subclipse + X

I'm using Eclipse that has SVN Integration. I think PHP Strom does so as well. I go into one of my trunk projects which are basically a checkout from WordPress svn repository.

Then I edit the files I need to edit. Eclipse shows which are modified, I right-click a directory, select Team->Create Patch and I get offered all changed files I can select for the diff. Then I can choose between copying to clipboard or saving to disk. I save all patches I create with the ticket number into a directory I have on my harddisk.

Then I go into the Browser and upload the patch.

I could also do this with a MyLyn Trac integration, that is even more comfortable, but you need XML-RPC right in trac so you need a trac admin to contact. It works pretty well but I do not have it configured in every project and use that mainly when I make ticket rundowns.

So really, checkout Eclipse if you like. It's huge and slow so you need either a big computer. On small ones I made good experiences with Fedora Linux. Eclipse runs well on it. I know you're a PHP Storm fan but, well, I really like my Eclipse and it comes with a lot of extensions that really rock. Even for PHP :). But PHP Storm should basically do the checkout / patch stuff as well.

WordPress Eclipse 1x1

Ah and I have a tool in my OS that saves all directories I've used. So I can save the patches and upload the files fast because they are always from the same directory which I have in the recent list then.

Integration Example: PHP Code Sniffer, Eclipse and WordPress

share|improve this answer
    
Thanks for answering. I tried Eclipse and hated it. Too unresponsive and I just didn't like the interface. So it's a good answer for others for whom Eclipse is an option but your answer doesn't address my needs. I'll give it and up vote but I'd prefer a solution that isn't tied to IDE, also one that better explains the process. –  MikeSchinkel Aug 28 '10 at 19:55
    
Also I meant to say that PhpStorm has full SVN (and Git) integration but it's integration really requires a user to fully understand what effect each menu will have because it offers little-to-no guidance in how to work with them (there is plenty in the help files but as they are not context sensitive and since SVN+Git is a huge addition to PhpStorm it's easy to get completely lost in it all.) That's why I want to understand it at the core and not have to switch to IDEs I dislike to do it. –  MikeSchinkel Aug 28 '10 at 20:03
    
@MikeSchinkel - If SVN is too complicated for you (regardless which flavor of SVN + Editor) , then you can't create patches for the wordpress project. Basically if you dislike your UI's interface to SVN learn the commandline. But you need to learn anyway. You can use SVN with any editor you like btw.. I have one SVN trunk copyrunning and configured on a webserver so to create patches and test them. After I made one patch I remove local changes (revert) from my local copy and then can go on for other patches. It's always work. What else to say? –  hakre Oct 6 '10 at 9:57

I use these, myself:

https://core.trac.wordpress.org/ticket/9724

Though it's obviously more in the applying patch department. ;-)

share|improve this answer
    
Cool link and thanks for sharing. –  hakre Mar 11 '11 at 15:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.