0

是否可以在提交后挂钩中将新文件添加到存储库。

当用户提交文件时,必须将新文件添加到包含用户给出的提交评论的存储库中。

对于同一文件的第二次提交,需要附加已添加的文件。

我可以通过使用svn.exe add命令来做到这一点吗?

4

1 回答 1

1

Check the SVNBook for the answer:

Warning

While hook scripts can do almost anything, there is one dimension in which hook script authors should show restraint: do not modify a commit transaction using hook scripts. While it might be tempting to use hook scripts to automatically correct errors, shortcomings, or policy violations present in the files being committed, doing so can cause problems. Subversion keeps client-side caches of certain bits of repository data, and if you change a commit transaction in this way, those caches become indetectably stale. This inconsistency can lead to surprising and unexpected behavior. Instead of modifying the transaction, you should simply validate the transaction in the pre-commit hook and reject the commit if it does not meet the desired requirements. As a bonus, your users will learn the value of careful, compliance-minded work habits.

于 2012-09-04T08:57:09.517 回答