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