| 1 |
GIT |
| 2 |
--- |
| 3 |
|
| 4 |
F-Spot's source repository is in GNOME GIT, in the module 'f-spot'. |
| 5 |
|
| 6 |
For information on GNOME GIT, see: |
| 7 |
http://live.gnome.org/Git |
| 8 |
|
| 9 |
If you are not familiar with GIT, please read this page: |
| 10 |
http://live.gnome.org/Git/Developers |
| 11 |
|
| 12 |
Patches |
| 13 |
------- |
| 14 |
|
| 15 |
If you have a patch you'd like to submit, please open a bug describing your fix |
| 16 |
or feature on bugzilla.gnome.org (product 'f-spot'), and submit a merge request |
| 17 |
on Gitorious (http://gitorious.org/f-spot). The selection below describes how |
| 18 |
to do so: |
| 19 |
|
| 20 |
First, clone our git repository ("git clone git://git.gnome.org/f-spot"), apply |
| 21 |
your change and "git commit" it, preferably to a branch with a suitable name. |
| 22 |
|
| 23 |
Then create a clone of f-spot mainline on Gitorious, by selecting "Clone this |
| 24 |
repository on Gitorious" on the page for the "mainline" repository: |
| 25 |
http://gitorious.org/f-spot/mainline |
| 26 |
|
| 27 |
Once that's done, you'll end up on a special page for your clone on Gitorious. |
| 28 |
It contains a "push URL", which you'll need in the next step. It should look |
| 29 |
like this: |
| 30 |
git@gitorious.org:~yourusername/f-spot/yourusernames-clone.git |
| 31 |
|
| 32 |
Add this push URL as a remote to your local repository (replace the words |
| 33 |
yourname and pushURL with applicable values. You can choose the value of |
| 34 |
yourname, pushURL should be the push url for your repository): |
| 35 |
git remote add yourname pushURL |
| 36 |
|
| 37 |
You can push the change you created in the first step to Gitorious using the |
| 38 |
following command (again replace yourname and branchname): |
| 39 |
git push yourname branchname |
| 40 |
|
| 41 |
The change should now show up on the Gitorious web page, and you can request a |
| 42 |
merge using the "Request merge" link on the page for your clone. Please |
| 43 |
provide a link to the bug you filed in Bugzilla in the merge request. |
| 44 |
|
| 45 |
We will review the patch, but if people are busy it might not happen right |
| 46 |
away. |
| 47 |
|
| 48 |
In the past we'd been doing patch review on the mailing list, but that hasn't |
| 49 |
always worked very well. Sometimes patches get lost in the shuffle. |
| 50 |
|
| 51 |
Coding Style |
| 52 |
------------ |
| 53 |
|
| 54 |
F-Spot attempts to follow the Mono coding conventions. The following |
| 55 |
description of those conventions was shamelessly stolen from Beagle's |
| 56 |
HACKING file. |
| 57 |
|
| 58 |
* Tagging buggy code |
| 59 |
|
| 60 |
If there is a bug in your implementation tag the problem by using |
| 61 |
the word "FIXME" in the code, together with a description of the |
| 62 |
problem. |
| 63 |
|
| 64 |
Do not use XXX or TODO or obscure descriptions, because |
| 65 |
otherwise people will not be able to understand what you mean. |
| 66 |
|
| 67 |
|
| 68 |
* Basic code formatting |
| 69 |
|
| 70 |
In order to keep the code consistent, please use the following |
| 71 |
conventions. From here on `good' and `bad' are used to attribute |
| 72 |
things that would make the coding style match, or not match. It is not |
| 73 |
a judgement call on your coding abilities, but more of a style and |
| 74 |
look call. Please follow these guidelines to ensure prettiness. |
| 75 |
|
| 76 |
Use tabs for indentation, not spaces. |
| 77 |
|
| 78 |
Since many are using 8-space tabs, you might want to consider the Linus |
| 79 |
Torvalds trick to reduce code nesting. Many times in a loop, you will |
| 80 |
find yourself doing a test, and if the test is true, you will |
| 81 |
nest. Many times this can be changed. Example: |
| 82 |
|
| 83 |
|
| 84 |
for (i = 0; i < 10; i++) { |
| 85 |
if (Something (i)) { |
| 86 |
DoMore (); |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
This take precious space, instead write it like this: |
| 91 |
|
| 92 |
for (i = 0; i < 10; i++) { |
| 93 |
if (! Something (i)) |
| 94 |
continue; |
| 95 |
DoMore (); |
| 96 |
} |
| 97 |
|
| 98 |
A few guidelines: |
| 99 |
|
| 100 |
* Use a space before an opening parenthesis when calling |
| 101 |
functions, or indexing, like this: |
| 102 |
|
| 103 |
Method (a); |
| 104 |
b [10]; |
| 105 |
|
| 106 |
* Do not put a space after the opening parenthesis and the |
| 107 |
closing one, ie: |
| 108 |
|
| 109 |
good: Method (a); array [10]; |
| 110 |
|
| 111 |
bad: Method ( a ); array[ 10 ]; |
| 112 |
|
| 113 |
* Inside a code block, put the opening brace on the same line |
| 114 |
as the statement: |
| 115 |
|
| 116 |
good: |
| 117 |
if (a) { |
| 118 |
Code (); |
| 119 |
Code (); |
| 120 |
} |
| 121 |
|
| 122 |
bad: |
| 123 |
if (a) |
| 124 |
{ |
| 125 |
Code (); |
| 126 |
Code (); |
| 127 |
} |
| 128 |
|
| 129 |
* Avoid using unecessary open/close braces, vertical space |
| 130 |
is usually limited: |
| 131 |
|
| 132 |
good: |
| 133 |
if (a) |
| 134 |
Code (); |
| 135 |
|
| 136 |
bad: |
| 137 |
if (a) { |
| 138 |
Code (); |
| 139 |
} |
| 140 |
|
| 141 |
* When defining a method, use the C style for brace placement, |
| 142 |
that means, use a new line for the brace, like this: |
| 143 |
|
| 144 |
good: |
| 145 |
void Method () |
| 146 |
{ |
| 147 |
} |
| 148 |
|
| 149 |
bad: |
| 150 |
void Method () { |
| 151 |
} |
| 152 |
|
| 153 |
* Properties and indexers are an exception, keep the |
| 154 |
brace on the same line as the property declaration. |
| 155 |
Rationale: this makes it visually |
| 156 |
simple to distinguish them. |
| 157 |
|
| 158 |
good: |
| 159 |
int Property { |
| 160 |
get { |
| 161 |
return value; |
| 162 |
} |
| 163 |
} |
| 164 |
|
| 165 |
bad: |
| 166 |
int Property |
| 167 |
{ |
| 168 |
get { |
| 169 |
return value; |
| 170 |
} |
| 171 |
} |
| 172 |
|
| 173 |
Notice how the accessor "get" also keeps its brace on the same |
| 174 |
line. |
| 175 |
|
| 176 |
For very small properties, you can compress things: |
| 177 |
|
| 178 |
ok: |
| 179 |
int Property { |
| 180 |
get { return value; } |
| 181 |
set { x = value; } |
| 182 |
} |
| 183 |
|
| 184 |
* Use white space in expressions liberally, except in the presence |
| 185 |
of parenthesis: |
| 186 |
|
| 187 |
good: |
| 188 |
|
| 189 |
if (a + 5 > Method (Blah () + 4)) |
| 190 |
|
| 191 |
bad: |
| 192 |
if (a+5>Method(Blah()+4)) |
| 193 |
|
| 194 |
* For any new files, please use a descriptive introduction, like |
| 195 |
this: |
| 196 |
|
| 197 |
// |
| 198 |
// System.Comment.cs: Handles comments in System files. |
| 199 |
// |
| 200 |
// Author: |
| 201 |
// Juan Perez (juan@address.com) |
| 202 |
// |
| 203 |
// (C) 2002 Address, Inc (http://www.address.com) |
| 204 |
// |
| 205 |
|
| 206 |
* Switch statements have the case at the same indentation as the |
| 207 |
switch: |
| 208 |
|
| 209 |
switch (x) { |
| 210 |
case 'a': |
| 211 |
... |
| 212 |
case 'b': |
| 213 |
... |
| 214 |
} |
| 215 |
|
| 216 |
* Private variable and function local variable names are under_scored |
| 217 |
(no camelCase please). |
| 218 |
|
| 219 |
If you are using Emacs, you might want to put something like this |
| 220 |
in your .emacs file: |
| 221 |
|
| 222 |
(defun poor-mans-csharp-mode () |
| 223 |
(java-mode) |
| 224 |
(setq mode-name "C#") |
| 225 |
(set-variable 'tab-width 8) |
| 226 |
(set-variable 'indent-tabs-mode t) |
| 227 |
(set-variable 'c-basic-offset 8) |
| 228 |
(c-set-offset 'inline-open 0) |
| 229 |
(c-set-offset 'case-label 0) |
| 230 |
) |
| 231 |
|
| 232 |
(setq auto-mode-alist (append '(("\\.cs\\'" . poor-mans-csharp-mode)) |
| 233 |
auto-mode-alist)) |
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
Unit Tests |
| 239 |
---------- |
| 240 |
|
| 241 |
Unit tests using Nunit should follow a very simple structure. The |
| 242 |
class being tested should include an inner class (typically called |
| 243 |
Tests) that is marked with the [TestFixture] attribute and should |
| 244 |
include one or more methods marked with [Test] attributes. The entire |
| 245 |
test class and any using statements should be surrounded by an #if |
| 246 |
ENABLE_NUNIT directive so that f-spot can still build on systems without |
| 247 |
nunit installed. |
| 248 |
|
| 249 |
|
| 250 |
References and standards |
| 251 |
------------------------ |
| 252 |
|
| 253 |
* .desktop file specification: http://standards.freedesktop.org/desktop-entry-spec/latest/index.html |
| 254 |
* thumbnail caching: http://people.freedesktop.org/~vuntz/thumbnail-spec-cache/ |