Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 8193002

Browse files
committed
Merge pull request #393 from symfony-cmf/commit_propsal
[Proposal] New PR and commit requirements
2 parents 4c49510 + 8eef0e6 commit 8193002

File tree

4 files changed

+120
-2
lines changed

4 files changed

+120
-2
lines changed

contributing/code.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ Contributing
44
The Symfony2 CMF team follows all the rules and guidelines of the core
55
Symfony2 `development process`_.
66

7-
When creating Pull Requests, please follow the Symfony `Submitting a Patch`_ guidlines.
7+
When creating Pull Requests, please follow the Symfony `Submitting a Patch`_
8+
guidelines.
9+
10+
.. tip::
11+
12+
See :doc:`commits` for the commit conventions used by the Symfony CMF
13+
team.
814

915
Resources / Links
1016
-----------------
@@ -25,4 +31,4 @@ Resources / Links
2531
.. _`IRC channel`: irc://freenode/#symfony-cmf
2632
.. _`Users mailing list`: http://groups.google.com/group/symfony-cmf-users
2733
.. _`Devs mailing list`: http://groups.google.com/group/symfony-cmf-devs
28-
.. _`Submitting a Patch`: http://symfony.com/doc/current/contributing/code/patches.html
34+
.. _`Submitting a Patch`: http://symfony.com/doc/current/contributing/code/patches.html

contributing/commits.rst

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
Commit Conventions
2+
==================
3+
4+
The Symfony CMF uses a convention for the commits. This isn't a requirement
5+
when contributing to the CMF, but it is created to have meaningfull commits
6+
for big new features.
7+
8+
Squashing
9+
---------
10+
11+
Before a Pull Request is merged, the commits should be squashed (i.e. there
12+
should be a single commit in the Pull Request with all your work in it).
13+
14+
You can easily squash a commit using `git rebase` as follows:
15+
16+
.. code-block:: bash
17+
18+
$ git rebase --interactive HEAD~<number of commits in your pull request>
19+
20+
For example, if your pull request on github has 4 commits:
21+
22+
.. code-block:: bash
23+
24+
$ git rebase --interactive HEAD~4
25+
26+
You will then be presented with a screen in your editor which looks something
27+
like this:
28+
29+
.. code-block:: bash
30+
31+
pick 5d4530b port features from simple cms into routing bundle to simplify things
32+
pick 1a0eea3 cs fixes and cleanups according to feedback
33+
pick 8cbab56 convert settings to options
34+
pick 8f3e4f9 cleanups for the options refactoring
35+
36+
Tell github to pick the first one and squash the rest as follows:
37+
38+
.. code-block:: bash
39+
40+
pick 5d4530b port features from simple cms into routing bundle to simplify things
41+
s 1a0eea3 cs fixes and cleanups according to feedback
42+
s 8cbab56 convert settings to options
43+
s 8f3e4f9 cleanups for the options refactoring
44+
45+
Save the file and quit. GIT should now squash all your commits and ask you
46+
for a new commit message.
47+
48+
Commit Message
49+
--------------
50+
51+
The commit message should be formatted as follows:
52+
53+
.. code-block:: text
54+
55+
[<scope>] <short description>
56+
57+
Fixes: <list of issues fixed>
58+
59+
<long description>
60+
61+
BC Breaks (as required)
62+
---------
63+
64+
<list of BC breaks and required migrations>
65+
66+
Deprecations (as required)
67+
------------
68+
69+
<list of deprecations>
70+
71+
For example, the commit message of a PR fixing 2 issues and adding 2 BC breaks
72+
would be:
73+
74+
.. code-block:: text
75+
76+
[Initializer] Initializers use ManagerRegistry
77+
78+
Fixes: #1234, #4321
79+
80+
Initializers are now passed an instance of `ManagerRegistry` instead
81+
of the `Phpcr\Session`. This means that initializers can retrieve both
82+
the PHPCR session and the `DocumentManager`.
83+
84+
This PR also introduces a requirement that all initializers provide a name
85+
which can be used in diagnostics.
86+
87+
BC Breaks
88+
---------
89+
90+
- The `init` method of the InitializerInterface now accepts a
91+
`ManagerResistry` instead of a `PhpcrSession`. The PHPCR session can
92+
be retrieved using `$registry->getConnection` and the manager with
93+
`$registry->getManager()`;
94+
95+
- The first argument to the `GenericInitializer` constructor is now the
96+
name of the initializer.
97+
98+
Short Commit Message
99+
~~~~~~~~~~~~~~~~~~~~
100+
101+
Not all Pull Requests require this much information for the commit. In most
102+
cases, a more simpler commit convention is enough:
103+
104+
.. code-block:: text
105+
106+
<bug|feature|minor> [<scope>] <short description>
107+
108+
Where ``bug`` refers to a commit fixing bugs, ``feature`` to a commit adding
109+
features and ``minor`` to commits adding less relevant things (fixing code
110+
standard, adding comments, fixing typos, etc.).

contributing/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Contributing
55
:hidden:
66

77
code
8+
commits
89
bundles
910
releases
1011
license

contributing/map.rst.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
* :doc:`code`
2+
* :doc:`commits`
23
* :doc:`bundles`
34
* :doc:`releases`
45
* :doc:`license`

0 commit comments

Comments
 (0)