views:

75

answers:

2

I wrote a script which can auto commit in every 10 minutes. But it's commit message always same ("Code saved"). But i want to change some of them which are milestone.

This is my auto commit script:

cd c:\inetpub\wwwroot\siteCodes
svn commit -m "Code Saved"

How can i write a script which can give me a chance to write revision number and new commit message.

+7  A: 

This is a bad approach, you should not auto-commit. Source control should not be treated like a backup system.

Instead, commit when a logical chunk of work is completed. Always try to commit code in a state that will build properly. And then, you have the opportunity to type whatever commit message you want.

RedFilter
+1 - Wholeheartedly agree.
Otávio Décio
Thank you for your advice but i am working on virtual machine and i lost my all codes because of vmdk didn't work. And there might be a common usage svn servers. But for me, this is not bad way to use svn. Thus, i donot worry to loose my virtual machine because it is automatically commiting.
uzay95
@uzay95: if you are having problems with your virtual machine, fix those. Don't use SVN as a bandaid.
RedFilter
@OrbMan: What is the problem? Do you think SVN server is very upset because i use it that way?
uzay95
SVN isn't intended to be used this way, in a real environment with many programmers committing work in you certainly would not want to do this. There are several reasons for not auto-committing, a few of them are: harder to track changes and logs are flooded with trivial changes. If you were the only person then I suppose it isn't as bad but I'm certain there are other solutions that's geared toward your specific problem.
nevets1219
+3  A: 

To answer your actual question (at personal risk), svn requires explicit permission to be set in a hook script before it will allow the log message to be changed. I never have a repository long before I need this. Here's a batch file you can use. Put it in the repository's "hooks" folder and call it pre-revprop-change.bat

http://svn.haxx.se/users/archive-2006-03/0107.shtml

Or a little more readable version,

http://ayria.livejournal.com/33438.html

Of course, I agree with everyone else that your setup is very sub-optimal. But you'll inevitably need to change the log message for a good reason sooner or later. :)

harpo
+1 for taking a risk and showing how to do it. I also +1 OrbMan's statement that this is a bad idea.
Chris Thornton
I think this will help to me. Thank you. In my opinion this is not bad idea because svn server doesn't work for only one thing for my projects. I am lonely programmer and nobody confused with these "auto backup" messages. I feel very good even if i lose my computer because every line of code is in the same place with my real revisions. This is the most important thing for me ;) THANK YOU HARPO because of you answered my question and shared your idea.
uzay95