Ive gained so much knowledge/insight from this site in the past few years, now im actually hoping to get some enlightenment.
The scenario is as follows: You have the general structure of the repo (trunk,branches,tags) but added to the layout you have another directory called 'db_revs'. Now in the pre-commit, you take a dump of a specific database (the specifics are irrelevant) into a temporary file, say /tmp/REV.sql (REV being the HEAD revision number of the repo, or the transaction).
K all is well and you can just import that temp file into the repo at /db_revs/REV.sql Now obviously that import, even tho its happening during a commit, increments the revision of the repo. So when u do a commit at some point to say 'test.php' in the trunk and it completes at say revision 159, then the pre-commit runs as it should and the DB dump gets imported but then u r sitting with a tree in the repo-browser where 'trunk' is at revision 159, and 'db_revs', which has the imported dump, is at 158 (Ive made it so that the filename matches the revision ie: 159.sql but that file is then at revision 158). The HEAD revision before the commit in this eg was 157
NB If you're doing an import in a pre-commit, you need to add some logic to not perform the import, say by checking first for the existence of the temp file, otherwise it will cause, um, a stack overflow and your PC will quickly cra开发者_运维知识库wl to a stand still
So I wanted to know if it was possible to make an import to not commit its changes. I realise I might be barking up the wrong tree to begin with so I have another idea of doing this so that brings me to the 2nd part of my question, would it be possible to modify the list of files that the transaction is about to commit to the repo. I know this can be done to a WC but that wont help as a WC is a checked out copy of say the trunk so im not sure how u would add a file to the 'db_revs' folder which is above trunk?
Any help is greatly appreciated
Cheers Vaughan
The general answer is 'you are not permitted to modify any versioned information during the pre-* phase of the transaction'. This includes making changes to files or directories, or changes to properties on files or directories. Revision properties (such as svn:log or svn:author) are not versioned and are thus fair game.
The problem has been discussed in depth elsewhere, but it boils down to thus:
If you change the transaction in mid-flight, there is currently no mechanism for the svn server to tell the client that things have changed. Because there is no mechanism/no update, your client thinks he is up-to-date against the repo, when in fact he is not.
You might be able to get away with triggering an import/commit in a post-commit hook; by that time the server has created the revision and any changes are properly attributed to a later version. I don't know if this is supported or not.
精彩评论