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