~elementary-pantheon/contractor/master

« back to all changes in this revision

Viewing changes to HACKING

  • Committer: Daniel Foré
  • Date: 2016-02-18 00:27:27 UTC
  • mto: This revision was merged to the branch mainline in revision 138.
  • Revision ID: git-v1:bb85b43557e8190be996d81b6c99b5753aec2b59
add hacking file

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
====== Contractor - Contribute ======
 
2
 
 
3
**This document is licensed under the LGPL 2.1.**
 
4
This document is based on the HACKING file from the Midori browser project.
 
5
 
 
6
====== Testing the latest build ======
 
7
 
 
8
Get daily builds in Launchpad (https://launchpad.net/~elementary-os/+archive/daily ppa:elementary-os/daily).
 
9
 
 
10
====== Join IRC chat rooms ======
 
11
 
 
12
Join #elementary-dev on Freenode: https://kiwiirc.com/client/irc.freenode.net/elementary-dev.
 
13
 
 
14
====== Contribute without touching code ======
 
15
 
 
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!
 
18
 
 
19
====== Check out the sources ======
 
20
 
 
21
    bzr branch lp:contractor
 
22
 
 
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
 
25
 
 
26
====== Build the code ======
 
27
 
 
28
Refer to INSTALL for required dependencies.
 
29
 
 
30
Then:
 
31
 
 
32
    mkdir build
 
33
    cd build
 
34
    cmake .. -DCMAKE_INSTALL_PREFIX=/usr
 
35
    make
 
36
 
 
37
Run Contractor:
 
38
    ./contractor
 
39
 
 
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.
 
41
 
 
42
If you'd like to install from your local branch:
 
43
    sudo make install
 
44
 
 
45
====== Debugging issues ======
 
46
 
 
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).
 
48
 
 
49
    gdb ./contractor
 
50
    run --debug
 
51
 
 
52
====== Coding style and quality ======
 
53
 
 
54
Be sure to check the official elementary Code Style guide at:
 
55
    http://elementary.io/docs/code/code-style
 
56
 
 
57
Contractor's code should in general have:
 
58
 
 
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.
 
64
 
 
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) {//
 
69
 
 
70
====== Important: Keep fixes for different bugs in different branches ======
 
71
 
 
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.
 
74
 
 
75
The reasons to work in this way are the following:
 
76
 
 
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.
 
79
 
 
80
Be sure to understand this, and avoid a headache later!
 
81
 
 
82
====== Committing code ======
 
83
 
 
84
Make a branch which will contain your changes for fixing bug XXXX:
 
85
 
 
86
    bzr branch lp:contractor fix-XXXX
 
87
 
 
88
Tell Bazaar your name if you haven't yet:
 
89
 
 
90
    bzr whoami "Real Name <email@address>"
 
91
 
 
92
See what you did so far:
 
93
 
 
94
    bzr diff
 
95
    bzr diff | colordiff
 
96
 
 
97
Get an overview of changed and new files:
 
98
 
 
99
    bzr status
 
100
 
 
101
Add new files, move/ rename or delete:
 
102
 
 
103
    bzr add FILENAME
 
104
    bzr mv OLDFILE NEWFILE
 
105
    bzr rm FILENAME
 
106
 
 
107
After making your changes, you need to commit your work as a new revision.
 
108
 
 
109
    bzr commit -m "Commit message"
 
110
 
 
111
Commit your changes in small increments. It is better to keep different changes in different commits.
 
112
 
 
113
To see the last 5 revisions in the current branch:
 
114
 
 
115
    bzr log -l5
 
116
    bzr log -l5 -p | less
 
117
 
 
118
In the case you committed something wrong or want to ammend it:
 
119
 
 
120
    bzr uncommit
 
121
 
 
122
If you want to revert all the changes made after the last revision:
 
123
    bzr revert
 
124
 
 
125
Remember to keep your branch updated:
 
126
 
 
127
    bzr pull
 
128
 
 
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.
 
130
 
 
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.//
 
132
 
 
133
====== Push proposed changes ======
 
134
 
 
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.
 
136
 
 
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.
 
138
 
 
139
    bzr push lp:~USERNAME/contractor/fix-123456
 
140
    bzr lp-open
 
141
 
 
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.
 
145
 
 
146
 
 
147
**What happens to all the branches?**
 
148
 
 
149
Leave the branches alone, **approved branches are cleared automatically** by Launchpad.
 
150
 
 
151
For larger feature branches, **use the team** in Launchpad to allow other developers to work on the code with you.
 
152
 
 
153
 
 
154
What if I want to help out on an **existing merge request** that I can't push to?
 
155
 
 
156
    bzr branch ~OTHERPERSON/contractor/fix-123456
 
157
    cd fix-123456
 
158
    # make commits
 
159
    bzr push lp:USERNAME~/contractor/fix-123456
 
160
    bzr lp-open
 
161
 
 
162
And in the Launchpad web overview of your branch, propose your branch for merging into ~OTHERPERSON/contractor/fix-123456
 
163
 
 
164
 
 
165
Updating a branch that may be out of sync with trunk:
 
166
 
 
167
    bzr pull
 
168
    bzr: ERROR: These branches have diverged
 
169
    bzr merge lp:contractor
 
170
    # Hand-edit conflicting changes
 
171
    bzr resolve FILENAME
 
172
    # If any conflicts remain continue fixing
 
173
    bzr commit -m 'Merge changes from lp:contractor'
 
174
 
 
175
 
 
176
Save a little bandwidth, **branch from an existing local copy** that you keep around:
 
177
 
 
178
    bzr branch lp:contractor contractor
 
179
    bzr branch contractor fix-123456
 
180
    cd fix-123456
 
181
    bzr pull lp:contractor