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 | | }}} |
| 8 | Providing a patch is no guarantee that the change will actually make it into the repository. |
| 9 | 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: |
| 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 |
| 66 | 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: |
| 67 | {{{ |
| 68 | Index: /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 | |
| 86 | This format is called an "unified diff format". |
| 87 | |
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 | | |