tags:

views:

106

answers:

2

Let's say I have a text file to commit using Subversion. Prior to commit, a pop-up window will appear consisting of the files to commit and a message box wherein I may place my comments regarding the changes for said file.

First question, I'd like to verify if it is possible to place the message that I placed at the message box of the pop-up window at the bottom of the text file that I will commit.

Second, If yes, please advise on how to implement. I really don't have ideas regarding pre-commit.

+4  A: 

No it's not possible. See this answer from the Subversion FAQ:

Does Subversion have a keyword which behaves like $Log$ in CVS?

No. There is no equivalent for the $Log$ keyword in CVS. If you want to retrieve a log for a specific file, you can run 'svn log your-file-name' or 'svn log url-to-your-file'. From the mailing list some explanations why $Log$ is bad:

"$Log$ is a total horror the moment you start merging changes between branches. You're practically guaranteed to get conflicts there, which -- because of the nature of this keyword -- simply cannot be resolved automatically."

And:

Subversion log messages are mutable, they can be changed by setting the svn:log revision property. So the expansion of $Log:$ in any given file could be out of date. Update may well need to retrieve the appropriate log message for each occurrence of the $Log:$ keyword, even if the file that contained it was not otherwise updated.

I don't care about that. I want to use it anyway. Will you implement it?

No. There are no plans to implement it ourselves or accept patches which implement this feature. If you want to distribute your files with some kind of changelog included, you might be able to work around this limitation in your build system.

flodin
thanks! thanks! now I know its not possible.
grayman
A: 

You could of course write your own commit dialog rebuilding something like TortoiseSVN's commit dialog (for example using PySVN and PyQt) that appends the commit message to the file (and thus modified the file) before committing. However, I'd strongly advise against doing so for the reasons given by flodin and simply because it's the VCS' job to handle the commit messages -- not the source files. If you want to have the commit messages offline available I'd suggest using a script to write them into a file. Alternatively, mirror the svn repository with a DVCS like git or bzr.

bluebrother