Using an Editor for Entering Log Messages from Command Line
When you are using Apache Subversion from the command line, whether from Windows or UNIX, it is possible to have an editor pop-up and enter the required Log Message.
There are three methods for getting the Log Message into Subversion.
1) Use the –message (-m) option and put the message string in quotes.
svn ci –m”Fixed bug # 4322”
2) Use the –file (-F) option and put the message in a file
svn ci –F logtxt.dat
3) Or, have SVN launch an editor and use it to compose your message.
Of these three, the last one is the easiest.
If you do not use any of the above options, you will receive the following message.
Setting up an editor is quite easy. There are two different options.
Use the configuration file or use an environmental variable to point to the editor.
To use the configuration file you need to modify the config file and add the line that tells Subversion to use an external editor.
### Section for configuring external helper applications.
[helpers]
### Set editor-cmd to the command used to invoke your text editor.
### This will override the environment variables that Subversion
### examines by default to find this information ($EDITOR, et al).
editor-cmd = notepad.exe
To use the environmental variable, set the EDITOR variable to your editor. In the command window, execute the following line.
set EDITOR=notepad.exe
You can use any editor that can be initiated from the command line. I have used both Notepad and TextPad.
Below, I show the screen that comes up in Notepad, then the screen filled out with my comments, then running the Log Command to see the new log message.
This is the screen that pops-up when using notepad.exe. The existing text tells you the file(s) modified and where to add the Log Message.
Here I have added in the Log Message. After this save the file, then exit the editor.
Here I ran the “LOG” command to see the new Log Message. Note: The extra lines in the editor were purged.
If you exit your editor without saving its contents, you will receive the following message.
The options are:
(a)bort – Cancel the COMMIT command.
(c)ontinue-Finish the commit with no Log Message.
(e)dit-Bring the editor back.
Mike Lester is WANdisco’s Director of Training. Mike has more than 33 years of experience in the software industry, having spent the past 26 years focusing on training and consulting for Subversion and other software configuration management systems. Mike delivers WANdisco’s free training webinars, and regularly shares his SVN know-how at the WANdisco blog. Mike is also available for Enterprise Training.




























