I want to automatically commit the database when we copy files from one branch to the other in Subversion. Is it safe to use svn commmit as part of a pre-commit hook assuming that we do it in very specific cases?
I want to automatically commit the database when we copy files from one branch
Share
Even if it’s safe, it probably doesn’t have the effect you would expect.
When you’re in pre-commit the new transaction has already been created, but not committed. You have access to that information to do your work, but an additional
svn commitwould create a separate transaction that is also not committed, yet.That new transaction wouldn’t see any of the changes in your current transaction, because it hasn’t been finalized, yet.
You probably want some custom scripts you run to do this for you, maybe part of your build system.
Additionally, you need a working copy to commit from, you don’t have that where the
pre-commithook runs, on the server. You might be able to cobble something together with a shared working copy and hope no two people cause thepre-commithook to run at the same time, but again, you’re probably better off with a custom scripting solution.