Subversion commit from UltraEdit

One more reason to love this awesome tool (UltraEdit, 15.20 - license for life!) is that it allows you to execute arbitrary scripts or applications (external tools) from within the editor. Today I set it up so that I can commit the file I am currently editing to SVN.

I have two tasks set up for this: one will commit with a default comment and the other will open Notepad to allow me to type in a comment. Here is how I set them up.

  1. Set up the SVN task that will commit with a default comment. Select menu bar > Advanced > Tool Configuration > click Insert
    1. Select Command tab and enter the following:

      (Click for larger version.)
      1. Menu Item Name: SVN commit from UE
      2. Command Line: svn commit "%n%e" -m "- Robert Mark Bram. Periodic update from UltraEdit."
      3. Working Directory: %p
    2. Select Options tab and enter the following:

      (Click for larger version.)
      1. Program Type: DOS Program
      2. Select Save Active File
    3. Select Output tab and enter the following:

      (Click for larger version.)
      1. Command Output (DOS Commands): Output to list box
      2. Select Capture Output
      3. Replace selected text with: No Replace
    4. Click Apply
  2. And now set up the SVN task that will commit and ask you for a comment. Everything is the same as the last one, except for two things on the Command tab:
    1. Menu Item Name: SVN commit and write comment
    2. Command Line: svn commit "%n%e" --editor-cmd notepad
         Note you can leave out --editor-cmd notepad if you have the SVN_EDITOR environment variable set (to "notepad" for instance).
  3. SVN revert. Everything is the same as the last one, except for two things on the Command tab:
    1. Menu Item Name: SVN revert
    2. Command Line: svn revert "%n%e"
  4. SVN diff using the extremely excellent WinMerge tool. This one only works when I launch UltraEdit through Cygwin because of the intermediary script. Everything is the same as the last one, except for two things on the Command tab:
    1. Menu Item Name: SVN diff (Cygwin)
    2. Command Line: svn diff --diff-cmd /apps/WinMerge/svnWinMerge.sh -x -b "%n%e"
    3. This one has two pre-requisites. The first is that you have to install WinMerge. The second is the script svnWinMerge.sh which contains:
      #!/bin/bash
      WinMergeU.exe `cygpath -d -a "${6}"` `cygpath -d -a "${7}"` &

Some tips I learned along the way.

  • You must have SVN installed and the bin/install path MUST be in your PATH. Reboot if you only just installed it to make sure all applications pick it up.
  • I launch UltraEdit through Cygwin usually. That means UltraEdit has Cygwin paths available to it, and thus Cygwin svn. The advantage of this is some extra functionality and access to my Cygwin scripts. One disadvantage is that I need to use paths that will work in both DOS or Cygwin - or mark the tool as only working in one or the other.
  • %n means file name without the extension (e.g. readme out of readme.txt) and %e means dot with the extension (e.g. .txt out of readme.txt). %N%E will give the DOS short versions of the file name (which Cygwin SVN will choke on) and %n%e gives the full versions (which means you need to quote them in case there are spaces in there).
  • Make sure this is NOT selected: Menu bar > Advanced > Alternate Capture Method. I don't actually know what this option is for, but it broke all external tools for me.
  • I installed Notepad++ as well as UltraEdit, and use Notepad++ as my SVN comment editor. I do this by a) having Notepad++'s install directory in my PATH and 2) have my SVN_EDITOR environment variable set to notepad++ -multiInst. This means whenever I checkin without a comment, SVN will open a new instance of Notepad++ for me - which is required in case I already have an instance of it open. Why Notepad++? A bit to see if I can. But also because I launch UltraEdit from Cygwin, and Notepad doesn't handle the Linux line endings nicely.. Plus, I like the way Notepad++ handles highlighting all instances of a token you select.
  • You can also use UltraEdit (new instance) for your checkin comments. Set the SVN_EDITOR environment variable set to Uedit32.exe /fni. Thanks to Mofi in the UltraEdit forum post Prompt for Comment on SVN checkin.

Popular Posts