Patches

From Scantegrity Wiki

Revision as of 14:58, 16 December 2008 by 130.85.93.101 (talk) (Undo revision 623 by 212.95.54.166 (Talk))

Anyone can contribute to the Scantegrity voting system project, and that is probably why you are here! The standard mechanism for expressing the contributions is through a patch or diff file, which is simply a set of instructions showing what will be changed in the source code.

Thank you in advance for your patch. You are doing a good thing, and democracy will thank you for it!

Creating a Patch

Once you have finished changing the sources to suit your needs, you can create a patch to share with the community. If you are using a GUI to access the subversion repository, consult your documentation on how to do this. You can create a patch using the command line subversion tools with the following instructions:

  • Add all source files you created to the repository.
$ svn add file1
$ svn add file2
  • Go to the top of your source tree.
  • Run the SVN diff command.
$ svn diff > my.patch

Note: It is preferred your name your patches something relevant to what you changed (i.e. if you fixed a bug, name it fixed-b1234.patch).

Applying a Patch

If you want to apply someone's patch to your source tree:

  • Download and save the patch to the top-level directory of your source tree.
  • Apply the patch:
$ patch -p0 < joes.patch

Again, if you are using a GUI to access the repository, you should consult the documentation for how to do apply patches.

Submitting a Patch

Patches must be reviewed by the community. When your patch is accepted, a developer with commit permissions will add your patch to the repository.

The general procedure is to mail patches to dev@scantegrity.org, starting the subject line with [PATCH]. Here are some examples:

  $ Subj: [PATCH] fix for infinite printing problem in printer module
  $ Subj: [PATCH] fix for b1234, 


The b stands for bug.

Guidelines

Sometimes your patch will not be accepted immediately. You can minimize that chance by observing the following guidelines:

  • One coherent change per patch. Please do not submit patches that fix multiple issues. You can always submit another patch.
  • Include a concise description of what your patch does, and include a logical title of what your patch is about. If your patch fixes a known issue or bug, please include it as a link in the text and/or as a reference in the header.
  • If you add a new feature, give complete details about it, as well as a rationale for why it will not affect the rest of the system.
  • Obey the Coding Standards.
  • Make sure it passes Testing, doesn't break another component, and that everything still compiles.
  • Add a test to the testing utility for your patch.