~drizzle-trunk/drizzle/development

2197.2.2 by Andrew Hutchings
Add basic contributing section to docs
1
.. _code-label:
2
3
Contributing Code
4
=================
5
6
SSH Keys
7
--------
8
9
You will need to add a public SSH key to Launchpad to be able to push branches
10
up for merging.  To do this:
11
12
 #. Generate an SSH key (information on how to do this is in `Launchpad's help pages <https://help.launchpad.net/YourAccount/CreatingAnSSHKeyPair>`_)
13
 #. Go to `your SSH keys page <https://launchpad.net/people/+me/+editsshkeys>`_
14
 #. Paste your public key into the text box and click the *Import public key*
15
    button
16
17
Getting the Code
18
----------------
19
20
You will need to prepare a directory for working with Drizzle, the following
21
example will assume you want to do this in ~/repos/drizzle:
22
23
.. code-block:: bash
24
25
   mkdir ~/repos
26
   cd ~/repos
27
   bzr init-repo drizzle
28
29
At this stage you now have an initialized a directory for bzr to use.  Revision
30
data will be stored here to save it having to be downloaded/stored for every
31
branch.
32
33
.. code-block:: bash
34
35
   cd drizzle
36
   bzr branch lp:drizzle trunk
37
38
This will take a little while, it is getting all the revisions since the
39
beginning of the repository.  This should only ever need to be done once though.
40
41
.. code-block:: bash
42
43
   bzr branch trunk drizzle-bug-NNNNNN
44
   cd drizzle-bug-NNNNNN
45
46
This creates a branch from trunk for you to work on.
47
48
Committing Work
49
---------------
50
51
All commits need to have a proper description of the changes made.  This is so
52
that future developers can dig through the bzr log to find out why a certain
53
change happened.
54
55
When committing a bug fix please use:
56
57
.. code-block:: bash
58
59
   bzr commit --fixes lp:NNNNNN
60
61
This will automatically attach the branch to the bug report when the branch is
62
pushed up.
63
64
Coding Standards
65
----------------
66
67
Our coding standards can be found inside the
68
`Drizzle wiki <http://wiki.drizzle.org/Coding_Standards>`_.
69
70
Test Cases
71
----------
72
73
Where possible SQL test cases should be created for your code.  Our test cases
74
for bug fixes should be in the ``tests/suite/regression`` directory.  For more
75
information about creating test cases please see the :ref:`test run <test-run-label>`
76
section of our documentation.
77
78
Pushing Work
79
------------
80
81
When you want to push your branch to Launchpad for others to see or for merging
82
you can use:
83
84
.. code-block:: bash
85
86
   bzr push lp:~username/drizzle/trunk-bug-NNNNNN
87
88
This will create the branch on Launchpad which you will be able to see on the
89
`code page <https://code.launchpad.net/drizzle>`_.  If you make some more commits you simply need to do just ``bzr push`` to get those revisions on Launchpad
90
too.
91
92
Merge Proposals
93
---------------
94
95
Once your work is done and ready for review you can go to the
96
`code page <https://code.launchpad.net/drizzle>`_, click on your branch and you
97
will see a link saying *Propose for merging*.
98
99
In this screen simply fill in what this branch does and click the
100
*Propose Merge* button.  Someone will review the branch, usually within a day or
101
two and if approved it will go though our rigourous testing process which can
102
take several hours.  If it needs more work feedback will always be given to
103
explain why.