5367262a3166fd87c2cadf77932682e73b697d4a
[gitmo/Moose.git] / lib / Moose / Manual / Contributing.pod
1 =pod
2
3 =head1 NAME
4
5 Moose::Manual::Contributing - How to get involved in Moose
6
7 =head1 GETTING INVOLVED
8
9 Moose is an open project, and we are always willing to accept bug fixes,
10 more tests, and documentation patches. Commit bits are given out freely, and
11 the L</STANDARD WORKFLOW> is very simple. The general gist is: clone the Git
12 repository, create a new topic branch, hack away, then find a committer to
13 review your changes.
14
15 =head1 NEW FEATURES
16
17 Moose already has a fairly large feature set, and we are currently
18 B<not> looking to add any major new features to it. If you have an
19 idea for a new feature in Moose, you are invited instead to create a
20 MooseX module first.
21
22 At this stage, no new features will even be considered for addition
23 into the core without first being vetted as a MooseX module, unless
24 it is absolutely 100% impossible to implement the feature outside the
25 core.
26
27 If you think it is 100% impossible, please come discuss it with us on IRC or
28 via e-mail. However, your feature may need a small hook in the core, or a
29 refactoring of some core modules, and we are definitely open to that.
30
31 Moose was built from the ground up with the idea of being highly
32 extensible, and quite often the feature requests we see can be
33 implemented through a couple of small and well placed extensions. Try
34 it, it is much easier then you might think.
35
36 =head1 PEOPLE
37
38 As Moose has matured, some structure has emerged in the process.
39
40 =over
41
42 =item Contributors - people creating a topic or branch
43
44 You.
45
46 If you have commit access, you can create a topic on the main Moose.git,
47 otherwise either give us your SSH key or create your own clone of the
48 L<git://git.moose.perl.org/Moose.git> repository or fork of the GitHub mirror.
49
50 =item Core Committers - people reviewing and merging a branch
51
52 These people have worked with the Moose codebase for a while.
53
54 They've been responsible for large features or branches and can help review
55 your changes and apply them to the master branch using the basic
56 L</APPROVAL WORKFLOW>.
57
58 They are also fairly well versed in Git, in order to merge the branches with
59 no mistakes (especially when the merge fails), and to provide advice to
60 contributors.
61
62 =item Cabal - people who can release moose
63
64 These people are the ones who have co-maint on Moose itself and can create a
65 release. They're listed under L<Moose/CABAL> in the Moose documentation. They
66 merge from Master to Stable.
67
68 =back
69
70 =head1 BRANCH LAYOUT
71
72 The repository is divided into several branches to make maintenance easier for
73 everyone involved. The branches below are ordered by level of stability.
74
75 =over
76
77 =item Stable (refs/heads/stable)
78
79 The branch from which releases are cut. When making a new release, the
80 release manager merges from master to stable. The stable branch is only
81 updated by someone from the Cabal during a release.
82
83 =item Master (refs/heads/master)
84
85 The branch for new development. This branch is merged into and branched from.
86
87 =item Branches (refs/heads/*)
88
89 Large community branches for big development "projects".
90
91 =item Topics (refs/heads/topic/*)
92
93 Small personal branches that have been published for review, but can get
94 freely rebased. Targeted features that may span a handful of commits.
95
96 Any change or bugfix should be created in a topic branch.
97
98 =back
99
100 =head1 STANDARD WORKFLOW
101
102     # update your copy of master
103     git checkout master
104     git pull --rebase
105
106     # create a new topic branch
107     git checkout -b topic/my-feature
108
109     # hack, commit, feel free to break fast forward
110     git commit --amend                       # allowed
111     git rebase --interactive                 # allowed
112     git push --force origin topic/my_feature # allowed
113
114 Then ask for a review/approval (see L</APPROVAL WORKFLOW>), and merge
115 to master. If it merges cleanly and nobody has any objections, then it
116 can be pushed to master.
117
118 If it doesn't merge as a fast forward, the author of the branch needs to run
119
120     git remote update
121     git rebase origin/master # or merge
122
123 and bring the branch up to date, so that it can be merged as a fast forward
124 into master.
125
126 No actual merging (as in a human resolving conflicts) should be done when
127 merging into master, only from master into other branches.
128
129 =head2 Preparing a topic branch
130
131 Before a merge, a topic branch can be cleaned up by the author.
132
133 This can be done using interactive rebase to combine commits, etc, or even
134 C<git merge --squash> to make the whole topic into a single commit.
135
136 Structuring changes like this makes it easier to apply git revert at a later
137 date, and encourages a clean and descriptive history that documents what the
138 author was trying to do, without the various hangups that happened while they
139 were trying to do it (commits like "oops forgot that file" are not only
140 unnecessary noise, they also make running things like git bisect or git revert
141 harder).
142
143 However, by far the biggest benefit is that the number of commits that go into
144 master is eventually reduced, and they are simple and coherent, making it much
145 easier for people maintaining branches to stay up to date.
146
147 All large changes should be documented in L<Moose::Manual::Delta>.
148
149 =head1 APPROVAL WORKFLOW
150
151 Moose is an open project but it also an increasingly important one, whose stability
152 is depended on by many other modules. Therefore we need some basic set of
153 criteria for accepting and approving branches into the core. What follows is the
154 set of rough guidelines to be sure that all new code is properly vetted before it
155 enters the core.
156
157 It should be noted that if you want your specific branch to be approved, it is
158 B<your> responsibility to follow this process and advocate for your branch.
159 The preferred way is to send a request to the mailing list for review/approval,
160 this allows us to better keep track of the branches awaiting approval and those
161 which have been approved.
162
163 =over 4
164
165 =item Small bug fixes, doc patches and additional passing tests.
166
167 These items don't really require approval beyond one of the core contributors just
168 doing a simple review.
169
170 =item Larger bug fixes, doc additions and TODO or failing tests.
171
172 Larger bug fixes should be reviewed by at least one cabal member and should be
173 tested using the smolder script to be sure no new issues were introduced.
174
175 New documentation is always welcome, but should also be reviewed by a cabal
176 member for accuracy.
177
178 TODO tests are basically feature requests, see our L</NEW FEATURES> section for
179 more information on that. If your feature needs core support, create a topic/
180 branch using the L</STANDARD WORKFLOW> and start hacking away.
181
182 Failing tests are basically bug reports, you should find a core contributor and/or
183 cabal member to see if it is a real bug, then submit it and your test to the RT
184 queue. Source control is not a bug reporting tool.
185
186 =item New user-facing features.
187
188 Anything that creates a new feature that is visible to a user needs to be approved
189 by B<more then one> cabal member.
190
191 Make sure you have reviewed L</NEW FEATURES> to be sure that you are following the
192 guidelines. Do not be suprised if a new feature is rejected if it has not been either
193 first vetted as a MooseX module or you cannot prove it is impossible to implement
194 outside of core.
195
196 =item New internals features.
197
198 New features for Moose internals are less restrictive then user facing features,
199 but still require approval by B<at least one> cabal member.
200
201 Ideally you will have run a smolder script to be sure your not breaking any of the
202 MooseX modules or causing any other unforseen havok. If you do this (rather then make
203 us do it), it will only help to hasten your approval.
204
205 =item Backwards incompatible changes.
206
207 Anything that breaks backwards compatibility must be discussed by the cabal and
208 agreed to by a majority of the members.
209
210 We have a policy for what we see as sane L</BACKWARDS COMPATIBILITY> for Moose. If
211 your changes break back-compat, you must be ready to discuss and debate your change.
212
213 =back
214
215 =head1 RELEASE WORKFLOW
216
217     git checkout master
218     # edit for final version bumping, changelogging, etc
219     # prepare release (test suite etc)
220     git commit
221     git checkout stable
222     git merge master # must be a fast forward
223     git push both
224     # ship & tag
225
226 Development releases are made without merging into the stable branch.
227
228 =head1 EMERGENCY BUG WORKFLOW (for immediate release)
229
230 Anyone can create the necessary fix by branching off of the stable branch:
231
232     git remote update
233     git checkout -b topic/my-emergency-fix origin/stable
234     # hack
235     git commit
236
237 Then a cabal member merges into stable:
238
239     git checkout stable
240     git merge topic/my-emergency-fix
241     git push
242     # release
243     git checkout master
244     git merge stable
245
246 =head1 PROJECT WORKFLOW
247
248 For longer lasting branches, we use a subversion style branch layout, where
249 master is routinely merged into the branch. Rebasing is allowed as long as all
250 the branch contributors are using C<git pull --rebase> properly.
251
252 C<commit --amend>, C<rebase --interactive>, etc. are not allowed, and should
253 only be done in topic branches. Committing to master is still done with the
254 same review process as a topic branch, and the branch must merge as a fast
255 forward.
256
257 This is pretty much the way we're doing branches for large-ish things right
258 now.
259
260 Obviously there is no technical limitation on the number of branches. You can
261 freely create topic branches off of project branches, or sub projects inside
262 larger projects freely. Such branches should incorporate the name of the branch
263 they were made off so that people don't accidentally assume they should be
264 merged into master:
265
266     git checkout -b my-project--topic/foo my-project
267
268 (unfortunately Git will not allow C<my-project/foo> as a branch name if
269 C<my-project> is a valid ref).
270
271 =head1 THE "PU" BRANCH
272
273 To make things easier for longer lived branches (whether topics or projects),
274 the 'pu' branch is basically what happens if you merge all of the branches and
275 topics together with master.
276
277 We can update this as necessary (e.g. on a weekly basis if there is merit),
278 notifying the authors of the respective branches if their branches did not merge
279 (and why).
280
281 To update 'pu':
282
283     git checkout pu
284     git remote update
285     git reset --hard origin/master
286     git merge @all_the_branches
287
288 If the merge is clean, 'pu' is updated with C<push --force>.
289
290 If the merge is not clean, the offending branch is removed from
291 C<@all_the_branches>, with a small note of the conflict, and we try again.
292
293 The authors of the failed branches should be told to try to merge their branch
294 into 'pu', to see how their branch interacts with other branches.
295
296 'pu' is probably broken most of the time, but lets us know how the different
297 branches interact.
298
299 =head1 BRANCH ARCHIVAL
300
301 Merged branches should be deleted.
302
303 Failed branches may be kept, but consider moving to refs/attic/ (e.g.
304 http://danns.co.uk/node/295) to keep git branch -l current.
305
306 Any branch that could still realistically be merged in the future, even if it
307 hasn't had work recently, should not be archived.
308
309 =head1 TESTS, TESTS, TESTS
310
311 If you write I<any> code for Moose or Class::MOP, you B<must> add
312 tests for that code. If you do not write tests then we cannot
313 guarantee your change will not be removed or altered at a later date,
314 as there is nothing to confirm this is desired behavior.
315
316 If your code change/addition is deep within the bowels of
317 Moose/Class::MOP and your test exercises this feature in a non-obvious
318 way, please add some comments either near the code in question or in
319 the test so that others know.
320
321 We also greatly appreciate documentation to go with your changes, and
322 an entry in the Changes file. Make sure to give yourself credit!
323
324 =head1 BACKWARDS COMPATIBILITY
325
326 Change is inevitable, and Moose is not immune to this. We do our best
327 to maintain backwards compatibility, but we do not want the code base
328 to become overburdened by this. This is not to say that we will be
329 frivolous with our changes, quite the opposite, just that we are not
330 afraid of change and will do our best to keep it as painless as
331 possible for the end user.
332
333 The rule is that if you do something that is not backwards compatible, you
334 B<must> do I<at least> one deprecation cycle (more if it is larger change).
335 For really larger or radical changes dev releases may be needed as well (the
336 Cabal will decide on this on a case-per-case basis).
337
338 The preference with regard to deprecation is to warn loudly and often so that
339 users will have time to fix their usages.
340
341 All backwards incompatible changes B<must> be documented in
342 L<Moose::Manual::Delta>. Make sure to document any useful tips or workarounds
343 for the change in that document.
344
345 =head1 AUTHOR
346
347 Stevan Little E<lt>stevan@iinteractive.comE<gt>
348
349 Chris (perigrin) Prather
350
351 Yuval (nothingmuch) Kogman
352
353 =head1 COPYRIGHT AND LICENSE
354
355 Copyright 2009 by Infinity Interactive, Inc.
356
357 L<http://www.iinteractive.com>
358
359 This library is free software; you can redistribute it and/or modify
360 it under the same terms as Perl itself.
361
362 =cut