1
====== Contractor - Contribute ======
3
**This document is licensed under the LGPL 2.1.**
4
This document is based on the HACKING file from the Midori browser project.
6
====== Testing the latest build ======
8
Get daily builds in Launchpad (https://launchpad.net/~elementary-os/+archive/daily ppa:elementary-os/daily).
10
====== Join IRC chat rooms ======
12
Join #elementary-dev on Freenode: https://kiwiirc.com/client/irc.freenode.net/elementary-dev.
14
====== Contribute without touching code ======
16
- http://bugs.launchpad.net/contractor Go through problem reports and check Unconfirmed bugs or those lacking information and mark any duplicates you spot.
17
- https://translations.launchpad.net/contractor Help getting Contractor translated in your language!
19
====== Check out the sources ======
21
bzr branch lp:contractor
23
The development **trunk** (master, tip) is the latest iteration of the next release.
24
Browse it online and look for other branches at http://code.launchpad.net/contractor
26
====== Build the code ======
28
Refer to INSTALL for required dependencies.
34
cmake .. -DCMAKE_INSTALL_PREFIX=/usr
40
To run Contractor from a local branch, you will need to already have Contractor installed in your system, since configuration files are loaded from system directories.
42
If you'd like to install from your local branch:
45
====== Debugging issues ======
47
Testing an installed release may reveal crashers or memory corruption which require investigating from a local build and obtaining a stacktrace (backtrace, crash log).
52
====== Coding style and quality ======
54
Be sure to check the official elementary Code Style guide at:
55
http://elementary.io/docs/code/code-style
57
Contractor's code should in general have:
59
* 4 space indentation, no tabs.
60
* Between 80 to 120 columns.
61
* Prefer /* */ style comments.
62
* Call variables //animal// and //animal_shelter// instead of <del>camelCase</del>.
63
* Keep a space between functions/ keywords and round parentheses.
65
* Prefer //new Gtk.Widget ()// over //using Gtk; new Widget ()//
66
* No necessity to prefix anything from the GLib namespace. An exception to this rule is when using GOF.File and GLib.File in the same source file.
67
* Stick to standard Vala-style curly parentheses on the same line
68
* Cuddled //} else {// and //} catch (Error error) {//
70
====== Important: Keep fixes for different bugs in different branches ======
72
Branches that contain patches to fix more than one bug will be rejected, and you will be asked to supply a separate branch for every bug fix.
73
This doesn't apply to patches that are indivisible by nature, and that fix multiple bugs.
75
The reasons to work in this way are the following:
77
* If one of the bugs targeted by your branch is correctly fixed, but one of the other bugs is incorrectly fixed or needs corrections, the branch won't be accepted until everything looks ok for all bugs. This causes an unnecessary delay for the bugs that where fixed correctly.
78
* Suppose your branch was accepted for merging in the main one. Later, it is discovered that your branch introduces faulty behavior. The standard course of action for these situations is to revert the merge that introduced that faulty behavior. This will cause that all of your fixes are reverted (even the ones that didn't cause problems) because there was no way of discriminating between them. If a separate branch for each bug fixed existed, only the offending one would have been reverted, and not all of them.
80
Be sure to understand this, and avoid a headache later!
82
====== Committing code ======
84
Make a branch which will contain your changes for fixing bug XXXX:
86
bzr branch lp:contractor fix-XXXX
88
Tell Bazaar your name if you haven't yet:
90
bzr whoami "Real Name <email@address>"
92
See what you did so far:
97
Get an overview of changed and new files:
101
Add new files, move/ rename or delete:
104
bzr mv OLDFILE NEWFILE
107
After making your changes, you need to commit your work as a new revision.
109
bzr commit -m "Commit message"
111
Commit your changes in small increments. It is better to keep different changes in different commits.
113
To see the last 5 revisions in the current branch:
116
bzr log -l5 -p | less
118
In the case you committed something wrong or want to ammend it:
122
If you want to revert all the changes made after the last revision:
125
Remember to keep your branch updated:
129
As a general rule of thumb, ''bzr help COMMAND'' gives you an explanation of any command and ''bzr help commands'' lists all available commands.
131
//If you're a die-hard git user, http://zyga.github.io/git-lp/ checkout git-lp to use git commands with the Bazaar repository.//
133
====== Push proposed changes ======
135
If you haven't yet, https://launchpad.net/~/+editsshkeys check that Launchpad has your SSH key - you can create an SSH key with **Passwords and Keys** aka **Seahorse** or ''ssh-keygen -t rsa'' - and use ''bzr launchpad-login'' to make youself known to bzr locally.
137
If you checked out trunk, and added your patch(es), just **push it under your username** in Launchpad and you can **propose it for merging into trunk**. This will automatically request a **review from other developers** who can then comment on it and provide feedback.
139
bzr push lp:~USERNAME/contractor/fix-123456
142
The last command will open a summary of the current branch in your web browser. There, you will be able to propose it for merging into trunk.
143
Your branch will be reviewed by another developer. At this stage, you may be notified that changes need to be made to your branch, so keep an eye on your email inbox!
144
After the branch is approved by the reviewer, it will get merged into the main project's source code.
147
**What happens to all the branches?**
149
Leave the branches alone, **approved branches are cleared automatically** by Launchpad.
151
For larger feature branches, **use the team** in Launchpad to allow other developers to work on the code with you.
154
What if I want to help out on an **existing merge request** that I can't push to?
156
bzr branch ~OTHERPERSON/contractor/fix-123456
159
bzr push lp:USERNAME~/contractor/fix-123456
162
And in the Launchpad web overview of your branch, propose your branch for merging into ~OTHERPERSON/contractor/fix-123456
165
Updating a branch that may be out of sync with trunk:
168
bzr: ERROR: These branches have diverged
169
bzr merge lp:contractor
170
# Hand-edit conflicting changes
172
# If any conflicts remain continue fixing
173
bzr commit -m 'Merge changes from lp:contractor'
176
Save a little bandwidth, **branch from an existing local copy** that you keep around:
178
bzr branch lp:contractor contractor
179
bzr branch contractor fix-123456
181
bzr pull lp:contractor