canmove, Confirmed users
1,953
edits
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
== Commit Message Restrictions == | == Commit Message Restrictions == | ||
The purpose of these new restrictions implemented | The purpose of these new restrictions, implemented via a mercurial hook, is to prevent commit messages | ||
that do not have a bug number. We will still allow a small set of special commits lacking bugs numbers, like merges and backouts. | |||
This hook will be enabled on mozilla-central and every major branch that directly merges into it, | This hook will be enabled on mozilla-central and every major branch that directly merges into it, | ||
such as mozilla-inbound or integration branches, team branches, or established project branches. | |||
An example for a passing commit message would be, | An example for a passing commit message would be, | ||
<pre>Bug 577872 - Create WebM versions of Ogg reftests. r=kinetik</pre> | <pre>Bug 577872 - Create WebM versions of Ogg reftests. r=kinetik</pre> | ||
notice the Bug ##### and the r=. Also the | notice the <tt>Bug #####</tt> and the <tt>r=</tt> indicating the reviewer. Also the reviewer is not checked at the moment, it could be at a | ||
future time and you are strongly encouraged to include it. (Please no fake reviewers like "my-dog" or "burning"). | |||
You also can't commit bustage-fixes without a bug | You also can't commit bustage-fixes without a bug number anymore. This is intentional to keep track | ||
of the bug which caused it. | of the bug which caused it. | ||
Line 17: | Line 17: | ||
* Commit messages containing "bug" or "b=" followed by a bug number | * Commit messages containing "bug" or "b=" followed by a bug number | ||
* Commit messages containing "no bug" (please use this sparingly) | * Commit messages containing "no bug" (please use this sparingly) | ||
* Commit message | * Commit message indicating backout of a given 12+ digit changeset ID, starting with (back out|backing out|backed out|backout)( of)? (rev|changeset|cset)s? [0-9a-f]{12} | ||
* Commit | * Commit messages that start with "merge" or "merging" and are actually for a merge changeset. | ||
Special exceptions: | Special exceptions: | ||
* | * Updating the NanoJit import in the js/src tree ("Update nanojit-import-rev stamp.") | ||
* Commits by | * Commits by the special users "ffxbld", "seabld", "tbirdbld", or "cltbld". | ||
* When the commit is older then some date shortly after the hook has been enabled to allow merges from other branches. This exception will be lifted after a short period of time ( | * When the commit is older then some date shortly after the hook has been enabled, to allow merges from other branches. This exception will be lifted after a short period of time (probably a few months) after the hooks is enabled. | ||
* You can also specify "ALLOW BAD COMMIT MESSAGES" in the tip (latest) commit message to override all the restrictions. This is | * You can also specify "ALLOW BAD COMMIT MESSAGES" in the tip (latest) commit message to override all the restrictions. This is an extreme measure, so you should only do this if you have a very good reason. | ||
Explicitly disallowed: | Explicitly disallowed: | ||
* Commit messages containing "try: " to avoid unintentional commits that were meant for the try server. | * Commit messages containing "try: " to avoid unintentional commits that were meant for the try server. | ||
All | All tests for allowed or excluded messages are case case-insensitive. | ||
You can find the source code of this hook at | You can find the source code of this hook at | ||
Line 36: | Line 36: | ||
=== Local setup === | === Local setup === | ||
It is also possible to use this hook locally so you can | It is also possible to use this hook locally so you can see if there is something wrong | ||
with your commit messages before pushing. | with your commit messages before pushing. | ||
Line 42: | Line 42: | ||
<pre> | <pre> | ||
[hooks] | [hooks] | ||
pretxncommit. | pretxncommit.commit = python:commit-message.hook | ||
</pre> | </pre> | ||
You probably need to add | You probably need to add commit-message.py to your Python path. | ||
<pre> | <pre> | ||
export PYTHONPATH = ~/myhooks # assuming | export PYTHONPATH = ~/myhooks # assuming commit-message.py is in this folder | ||
</pre> | </pre> | ||
You can also edit | You can also edit commit-message.py to abort commits instead of warning. Search for "to fail not warn change to 1" (without the quotes) in the the file and change 0 to 1. |