Edgewall Software

Changes between Version 20 and Version 21 of TracDev/SubmittingPatches


Ignore:
Timestamp:
Sep 8, 2017, 1:44:04 AM (7 years ago)
Author:
Ryan J Ollos
Comment:

Put the most important information first.

Legend:

Unmodified
Added
Removed
Modified
  • TracDev/SubmittingPatches

    v20 v21  
    44Have you made some changes you'd like to submit to Trac? Great! We love to see them. To make things go smoothly for everyone, here are some guidelines on submitting your changes.
    55
    6 == What is a patch?
     6== What is a good patch?
    77
    8 A patch is a single file listing the changes you've made in a format that can be applied with the [http://savannah.gnu.org/projects/patch/ GNU patch] tool. It will look something like this:
    9 {{{
    10 Index: /branches/0.9-stable/trac/scripts/admin.py
    11 ===================================================================
    12 --- /branches/0.9-stable/trac/scripts/admin.py (revision 2822)
    13 +++ /branches/0.9-stable/trac/scripts/admin.py (revision 3521)
    14 @@ -12,9 +12,10 @@
    15  # history and logs, available at http://projects.edgewall.com/trac/.
    16  #
    17  
    18 +from __future__ import generators
    19 +
    20  __copyright__ = 'Copyright (c) 2003-2006 Edgewall Software'
    21  
    22 -from __future__ import generators
    23  import cmd
    24  import getpass
    25  import os
    26 }}}
     8Providing a patch is no guarantee that the change will actually make it into the repository.
     9The patch has to be endorsed by a Trac developer, who will carry the burden to maintain that change over time. So the patch has to feature the following:
     10 - clarity
     11   - no spurious changes like whitespace change or other random reformattings
     12   - no unrelated changes; if some refactoring really needs to be done prior to the actual change, better do that in a separate patch
     13   - strict adherence to the CodingStyle
     14 - maintainability
     15   - comments for the parts that needs to be commented, no more, no less
     16   - add UnitTests or FunctionalTests
     17   - make sure existing tests still pass with your change applied
     18 - code quality: the pertinence of the fix or the feature is the main criterion
    2719
    28 This format is called an "unified diff format". See below how to generate it.
     20See for example #8935, #9718.
     21
     22That can be hard to get right the first time, so you'll certainly get asked to improve your patch. You should be willing to take feedback into account and maybe do a few iterations of the patch.
    2923
    3024== Getting started
     
    7064== Make the patch
    7165
     66A patch is a single file listing the changes you've made in a format that can be applied with the [http://savannah.gnu.org/projects/patch/ GNU patch] tool. It will look something like this:
     67{{{
     68Index: /branches/0.9-stable/trac/scripts/admin.py
     69===================================================================
     70--- /branches/0.9-stable/trac/scripts/admin.py (revision 2822)
     71+++ /branches/0.9-stable/trac/scripts/admin.py (revision 3521)
     72@@ -12,9 +12,10 @@
     73 # history and logs, available at http://projects.edgewall.com/trac/.
     74 #
     75 
     76+from __future__ import generators
     77+
     78 __copyright__ = 'Copyright (c) 2003-2006 Edgewall Software'
     79 
     80-from __future__ import generators
     81 import cmd
     82 import getpass
     83 import os
     84}}}
     85
     86This format is called an "unified diff format".
     87
    7288Save your changes to the file "my_patch_file.diff":
    7389{{{#!sh
     
    99115After that, depending on lots of factors, your patch will be reviewed and eventually integrated. Most likely, you'll be asked to rework your patch a bit, according to the preferences of the Trac maintainers.
    100116
    101 == What is a good patch?
    102 
    103 Now, having written a patch is no guarantee that the change will actually make it into the repository.
    104 The patch has to be endorsed by a Trac developer, who will carry the burden to maintain that change over time. So the patch has to feature the following:
    105  - clarity
    106    - no spurious changes like whitespace change or other random reformattings
    107    - no unrelated changes; if some refactoring really needs to be done prior to the actual change, better do that in a separate patch
    108    - strict adherence to the CodingStyle
    109  - maintainability
    110    - comments for the parts that needs to be commented, no more, no less
    111    - add UnitTests or FunctionalTests
    112    - make sure existing tests still pass with your change applied
    113  - code quality: the pertinence of the fix or the feature is the main criterion
    114 
    115 See for example #8935, #9718.
    116 
    117 That can be hard to get right the first time, so you'll certainly get asked to improve your patch. You should be willing to take feedback into account and maybe do a few iterations of the patch.
    118 
    119117------
    120118See also: Mercurial:ContributingChanges#Patch_descriptions.