How can I require that two files be included in the same subversion commit?
I develop projects with databases which are maintained as a MySQL workbench file,开发者_JAVA百科 which is a binary file. Since you can't easily tell the difference in a binary file between to commits, it's required that you update the SQL create script for that schema before committing. That way, you can run a diff of the SQL file to see what changed.
Sometimes, people either forget or get lazy and don't update the SQL file. How can I use subversion to require that any commit which includes the workbench file must also include the SQL file?
You can write a Hook Script on the server to make this a requirement.
You can use the pre-commit-hook to check if it contains the workbench file and check if it contains the SQL file as well...if not abort the commit.
Although khmarbaise's answer is working, I propose you a better solution. Instead of forcing developers to edit the SQL file, try to update it automatically. It means that in a step of your build process (suppose that you have a build process) check the Workbench file and in the case of its update, change your SQL file automatically.
Unlike your question, I found that workbench files are not binary files. They are zipped files that contain the schema of the db in an xml format. See these two posts: Is it possible to save MySQL Workbench files as plain XML? and Subversion diff for zipped xml file
精彩评论