Need to avoid recursive call of pre-commit hook
Hi, I need to avoid recursive call of pre-commit hook. i ill set RES.txt to "FALSE" & try to commit, its needs to import the RES1.txt file to the Repository and exit(original commit need to fail). echo TRUE>C:\Users\satheesh\Desktop\RES.txt this is for avoiding Recursive call of pre-commit hook pre-commit.bat Initially RES.txt is FALSE @echo off SET REPOS=%1 SET TXN=%2 SET /p RES=
if %RES%==TRUE (
"C:\Users\satheesh\Desktop\SVN\svn-win32-1.7.6\bin\svn.exe" import C:\Users\venkateshkumarg\Desktop\RES1.txt svn://localhost:3939/Users/satheesh/Desktop/SVN/svn1.7.6/Repos/WireShark/res1.txt -m "Comments Added"
but it is not avoiding the recursive call any changes needed on above code to avoid recursive call.
That won't work. Multiple commits can run in parallel resulting in pre-commit being invoked multiple times in parallel. You need to detect the recursive commit using information inside the commit not information stored outside the commit. Options include: have the pre-commit use a special username to make the commit and then detect that username, have the pre-commit use a special log message and detect that log message, have the pre-commit set a special property or revision property and detect that, etc.
Thanks, If i use log msg & check like SET %log% = svnlook log -t %TXN% %REPOS% if (%log% == mycommit) ( "C:\Users\satheesh\Desktop\SVN\svn-win32-1.7.6\bin\svn.exe" import C:\Users\satheesh\Desktop\RES1.txt svn://localhost:3939/Users/satheesh/Desktop/SVN/svn1.7.6/Repos/WireShark/res1.txt -m "mycommit" echo success > Result.txt ) else exit 1 In this case it will exit from beginning itself(if i give "commit" as comment(from client) while checking in any file, it ill exit). because Instead of original commit(from client)i need to commit my own file(commit -import C:\Users\satheesh\Desktop\RES1.txt) & block the original commit from client. Pls give some example
I've just realised you are doing this from a pre-commit. It is almost always wrong to have pre-commit make a second commit. When the pre-commit runs there is no guarantee that the first commit is going to succeed. Making extra commits from the post-commit can work in some circumstances. Your current script makes no sense so it's hard to give advice.
philip;122608I've just realised you are doing this from a pre-commit. It is almost always wrong to have pre-commit make a second commit.Correction. It is always wrong to have pre-commit make another commit to the same repository. But there's lots of other things wrong here. The repository is being served off the OP's desktop, both literally (his workstation) and figuratively (the repository is actually stored in %USERPROFILE%\Desktop. And then the hook script references more files on the desktop and uses a relative path. On top of that, the EXE is installed to...the desktop as well!
Thanks all, Then Can i use revert to the previous revision in post-commit hook without having working copy ???
It's not clear what you mean. Do you want the post-commit to make a second commit to undo the commit that ran the post-commit? That sounds really odd. Aside from that, post-commit is asyncronous so you cannot rely on the post-commit order.
1-7 of 7
Reply to this discussion
You cannot edit posts or make replies: You should be logged in before you can post.