Project

General

Profile

DevelopersProcess » History » Version 3

Dan Smith, 12/24/2012 09:09 AM

1 1 Dan Smith
h1. CHIRP Development Process
2
3
h2. Mercurial Configuration
4
5
Make sure that your mercurial tool is configured properly for CHIRP. This means having the correct username and email address specified, as well as the MQ extension enabled (for most cases). You can do this in your global mercurial configuration file, or in the one in the repository you're working on, which is @.hg/config@. You may also want to ensure that it has the patchbomb configuration enabled, which allows easy emailing out of mercurial itself. You probably want the following lines in your config file:
6
7
<pre>
8
[ui]
9
username = Joe Bob <joebob@gmail.com>
10
[extensions]
11
hgext.mq=
12
hgext.patchbomb=
13
[email]
14
from = Joe Bob <joebob@gmail.com>
15
method = smtp
16
17
[smtp]
18
host = smtp.gmail.com
19
</pre>
20
21 3 Dan Smith
h2. Bug Tracking
22
23
All changes should have a bug created on the tracker before submission. The server hosting the repository will not allow changesets to be pushed that do not contain a bug number (see below). It is perfectly reasonable to create a bug, assign it to yourself, and then close it before sending the patch.
24
25 1 Dan Smith
h2. Submitting a patch
26
27 2 Dan Smith
Changes to CHIRP are welcome, but they should be in the correct format, and sent as a patch to the mailing list. The correct way to do this is to clone the upstream repository, make your changes there, and then soft-commit them as MQ patches to the tree. The following assumes you have cloned the repository and are in the resulting directory.
28
29
h3. Making a change
30
31
Edit one of the files to make a change. For this example, I'll use @chirp/ic2820.py@. Assuming I have made a change, the following commands help me see what has been done:
32
33
<pre>
34
% hg status -mar
35
M chirp/ic2820.py
36
% hg diff
37
diff -r a132c837fd25 chirp/ic2820.py
38
--- a/chirp/ic2820.py   Mon Dec 24 08:17:19 2012 -0800
39
+++ b/chirp/ic2820.py   Mon Dec 24 08:56:29 2012 -0800
40
@@ -16,6 +16,8 @@
41
 from chirp import chirp_common, icf, util, directory
42
 from chirp import bitwise
43
 
44
+# Just added a comment
45
+
46
 MEM_FORMAT = """
47
 struct {
48
   u32  freq;
49
</pre>
50
51
The first command shows me that @chirp/ic2820.py@ has been modified, and the second shows me the actual changes that have been made.
52
53
h3. Soft-committing a Change
54
55
You can commit a change directly to your tree, but it becomes a little more complicated to make changes to it if necessary, and it creates a fork when the change is actually accepted upstream. An easy way to manage all of this is to soft-commit your changes as MQ patches. Assuming you have made the change above, the following example shows the process for committing that into a patch:
56
57
<pre>
58
% hg qnew -ef add_comment # Here I will be prompted to enter a commit message
59
% hg qapplied             # This shows that the patch is now applied
60
add_comment
61
</pre>
62
63
This example takes the changes I made above, and commits them into a new patch called @add_comment@. I can now look at the patch in its entirety, as well as add or remove it from my local tree:
64
65
<pre>
66
% hg export tip           # This will show me the whole patch, with the commit message
67
% hg qpop                 # Remove it from the tree
68
% hg qapplied             # This shows that no patches are applied
69
% hg qunapplied           # This shows that our patch is not applied
70
add_comment
71
% hg qpush                # This adds the patch back to the tree
72
% hg qapplied             # This shows that our patch is applied
73
add_comment
74
% hg qpop                 # This removes it again
75
% hg qdel add_comment     # This deletes it permanently
76
</pre>
77
78
h3. Sending a change
79
80
There are two ways to do this. First, you can export the patch to a text file and email it to the list with your normal mailer. This is how:
81
82
<pre>
83
% hg export tip > add_comment.patch
84
</pre>
85
86
You can also configure the tool to email it directly, in which case you need only do:
87
88
<pre>
89
% hg email tip
90
</pre>
91
92
You will be prompted for the destination address.
93 3 Dan Smith
94
h2. Patch Guidelines
95
96
h3. The Commit Message
97
98
The commit message should have a first line that stands on its own and describes the patch briefly. If it pertains to a specific driver, put that driver's short name in brackets at the beginning. For example:
99
100
<pre>
101
[uv5r] Add support for firmware >= 291
102
</pre>
103
104
After the first line, more descriptive text may be added (and is appreciated) about what and why the change is being made. At the end, you must include a bug number in the format @#XXX@. This lets the system correlate changes to bugs, which helps during release time.
105
106
h3. Scope
107
108
Guidelines:
109
110
 * Patches should be small and concise. Try to keep a single standing change to a single patch.
111
 * Don't fix several bugs in a single patch, unless there is a technical reason to do so.
112
 * Don't fix, cleanup, or change random whitespace in the patch unless that is the sole purpose of the patch.