Share common / useful SVN pre-commit hooks [closed

2019-01-16 04:53发布

What are some common and/or useful pre-commit hooks for SVN?

22条回答
\"骚年 ilove
2楼-- · 2019-01-16 04:53
  • Check for tabs and reject the check-in.
  • Check for inconsistent line endings and reject the check-in.
  • Check for occurance of "CR: [username]" and reject the check-in if there is no code review.
查看更多
一夜七次
3楼-- · 2019-01-16 04:53

We use a pre-commit and post-commit hook combo to automatically update bugzilla with the associated entry from the svn commit.

We use a second (pre-commit) hook to ensure that the appropriate svn:eol-style and svn:keywords properties are set on a file before it is added to the repostitory.

We have a third (post-commit) hook to kick off a build and mail the results if the build is broken, and to inform everyone when the build has been fixed again.

We have a fourth (post-commit) hook to kick off svn replication, to ensure that the offsite replication is as up to date as possible.

Unfortunately, I cannot post the source to these, but, except for the Bugzilla integration, they are easy enough to implement, and Hudson is probably a better choice for continuous integration.

For bugzilla integration, I would suggest looking at scmbug.

查看更多
劫难
4楼-- · 2019-01-16 04:53

I check for case collision (stupid windows) and also require-mergeinfo.pl to ensure that the client is at least 1.5 - that way svn:mergeinfo will always be set

查看更多
Evening l夕情丶
5楼-- · 2019-01-16 04:54

In the company I currently work on, this is checked:

  • If binary files have the needs lock attribute set;
  • If the Java files have the standard copyright notice and if it includes the current year;
  • If the code is properly formatted (we use Jalopy for code formatting) - this may sound silly but it actually makes text comparisons between different versions easier;
  • If the code has a commit message;
  • If the directory structure conforms to what is defined (all projects should be under a defined SVN folder, and each project should have a tags, branch and trunk folder);

I guess that's it.

I like the idea of checking if the commit is associated with a ticket; it actually makes a lot of sense to me.

查看更多
聊天终结者
6楼-- · 2019-01-16 04:56

That a user has actually entered a comment on the commit message, and that it contains a particular issue number to track.

查看更多
啃猪蹄的小仙女
7楼-- · 2019-01-16 04:56

A great commit hook we have at on our archive is to check all .VCPROJ (or .CSPROJ) visual studio projects to make sure the output directories weren't changed to anything local (commonly used for debugging).

These problems will compile properly but still break the build because of missing executables.

查看更多
登录 后发表回答