Webtools:SVN Patch Guidelines

From MozillaWiki
Jump to: navigation, search

Here's how to commit a patch:

1. Get a checkout of Addons (or another project) from svn.mozilla.org:

 svn co svn+ssh://yourusername@svn.mozilla.org/addons/ addons/ 

2. Apply the patch you'll be committing.

 cd addons
 patch -p0 < patchfile

3. Do "svn add" for any new files or directories. Then make sure you didn't forget any new files or directories by doing:

 svn stat

Anything that shows up with a "?" in front of it might be something you need to add.

4. Commit the patch with "svn commit". This will bring up an editor window, using whatever your $SVN_EDITOR environment variable is set to in your shell. The following instructions assume you use vi, which is the default on many systems. If you use some other editor, refer to the documentation for your editor.

To start typing in the vi window, press the "i" key on your keyboard. Then you should enter a checkin comment that looks like this:

 Bug 123456: What The Patch Does Goes Here
 Patch By Full Name <username@domain.com> r=mkanat, a=justdave

Just replace everything in italics with the right thing. r= indicates the person(s) who reviewed your patch. a= indicates the person who approved it for checkin.

Note that the description given on the checkin comment should describe what the patch actually does (in a broad sense), which may not necessarily match the summary of the bug being fixed. For example, of the summary of the bug is "Bugzilla doesn't do Foo" then your description in the checkin comment should say something like "Make Bugzilla do Foo".

To close vi, save the message, and commit your changes, press ESC and then type

 :wq

on the keyboard, and press Enter. If you want to quit without committing (say, you made a mistake and you want to go back), instead of :wq you type :q! (with the exclamation point) and then "a" for "abort" after you leave vi.

5. SVN will print out a commit message. Make sure you copy this so you can add it as a comment on the bug when you mark the bug FIXED.

6. Paste the SVN commit message as a comment on the bug and mark it FIXED.