At certain times it is necessary to enforce certain conventions on committers.

One of those conventions is that log messages should follow a particular format, or contain a particular string.

For example, during a code freeze, commits to the branch that contains the release must contain the string "Approved by: re", otherwise the commit will be rejected.

There should be a flexible mechanism to enforce arbitrary standards on log messages, enabled on a per-path basis in the repository.

Current Implementation

CVS can automatically run scripts in the repository in response to various end-user actions. One of those scripts receives the log message prior to the commit, and can approve or deny the commit accordingly.

SVN Implementation

Subversion operates in a similar fashion to CVS. In particular, an executable called pre-commit-hook, placed in the hooks/ subdirectory at the top level of the repository storage area (note: not committed to the repository, but in a subdirectory that contains the repository's files) will automatically be executed prior to every commit.

This program may then examine the in-progress commit, review the commit log, and choose to allow or deny the commit.

Hg Implementation

Hg supports multiple entry points for hooks during operations. The complete list is there.

For our purposes, I see local hooks for local modifications (developers' branches and private areas) and use of the Patch_Queue_Manager as the main workflow manager.

Git Implementation

Git also supports hooks stored in ${REPO_DIR}/hooks/

Using the same process as for SVN and CVS.

Monotone Implementation

Supported (also see monotone:FeatureLogReview)

Monotone supports the validate_commit_message hook, which is passed a user's intended commit message and details of the revision about to be committed. Hooks are implemented in lua, and can make arbitrary programmatic assessements of the log message to decide whether to accept or reject it. The default hook simply rejects empty messages.

VersionControl/LogReview (last edited 2022-10-07T01:29:28+0000 by KubilayKocak)