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