Edit SVN Log Comments
Prolog - Almost once a lifetime, every developer comes across "Oops, forgot to enter comments before committing code changes". Following notes are aimed at helping technical folks - a situation where I have landed myself in and hence thought to write this blog.
Ideally, SVN hook should be configured to not allow a blank comment in the first place - but then gone is gone and its time to mend it.
Problem - Be Default, I have found editing comments on subversion is disabled. One might be able to open a window to edit the comments but when "ok" is clicked to do the job, following error message shows up
Error Message - "Repository has not been enabled to accept revision propchanges; ask the administrator to create a pre-revprop-change hook."
Solution - Following steps need to be performed to create/edit a hook to allow editing already logged comments (blank in my case since I forgot to log a comment).
Windows Operating System
1. Navigate to "hooks" directory within your subversion repository. Please note every subversion repository has its own hooks directory.
2. Create a "pre-revprop-change.bat" file. Please note default scripts in "hooks" directory are aimed at Unix/Linux based subversion environments.
3. Add following 4 lines of code to this bat file
a. rem Only allow log messages to be changed.
b. if "%4" == "svn:log" exit 0
c. echo Property '%4' cannot be changed >&2
d. exit 1
4. Save this file and exit.
5. Now edit your logged comments (including blank comments in my case) and subversion now allows editing comments.
Unix/Linux Operating System
1. Navigate to "hooks" directory within your subversion repository. Please note every subversion repository has its own hooks directory.
2. Create a "pre-revprop-change" file. Please note default scripts in "hooks" directory are aimed at Unix/Linux based subversion environments.
3. Add following 4 lines of code to this bat file
a. #!/bin/sh
b. exit 0;
4. Save this file and exit. Please note however that above line allows editing any property (not just svn:log).
5. chmod +x to give execute access to hook script.
6. Now edit your logged comments and subversion now allows editing comments.
It might be worthy to disable this script once done since ideally enterprise should not encourage editing subversion comments retrospectively. Rather a new server hook script must be created not to allow blank commits - an extension to this blog....
Ideally, SVN hook should be configured to not allow a blank comment in the first place - but then gone is gone and its time to mend it.
Problem - Be Default, I have found editing comments on subversion is disabled. One might be able to open a window to edit the comments but when "ok" is clicked to do the job, following error message shows up
Error Message - "Repository has not been enabled to accept revision propchanges; ask the administrator to create a pre-revprop-change hook."
Solution - Following steps need to be performed to create/edit a hook to allow editing already logged comments (blank in my case since I forgot to log a comment).
Windows Operating System
1. Navigate to "hooks" directory within your subversion repository. Please note every subversion repository has its own hooks directory.
2. Create a "pre-revprop-change.bat" file. Please note default scripts in "hooks" directory are aimed at Unix/Linux based subversion environments.
3. Add following 4 lines of code to this bat file
a. rem Only allow log messages to be changed.
b. if "%4" == "svn:log" exit 0
c. echo Property '%4' cannot be changed >&2
d. exit 1
4. Save this file and exit.
5. Now edit your logged comments (including blank comments in my case) and subversion now allows editing comments.
Unix/Linux Operating System
1. Navigate to "hooks" directory within your subversion repository. Please note every subversion repository has its own hooks directory.
2. Create a "pre-revprop-change" file. Please note default scripts in "hooks" directory are aimed at Unix/Linux based subversion environments.
3. Add following 4 lines of code to this bat file
a. #!/bin/sh
b. exit 0;
4. Save this file and exit. Please note however that above line allows editing any property (not just svn:log).
5. chmod +x to give execute access to hook script.
6. Now edit your logged comments and subversion now allows editing comments.
It might be worthy to disable this script once done since ideally enterprise should not encourage editing subversion comments retrospectively. Rather a new server hook script must be created not to allow blank commits - an extension to this blog....