Prompt for Comment on SVN checkin

Help with setting up and configuring custom user tools in UltraEdit (based on command line input)

Prompt for Comment on SVN checkin

Postby jeblackburn » Fri Nov 13, 2009 10:23 am

Those of you who use SubVersion know that you need to supply a message/comment when you check in files. I'd like to integrate UE with SVN nicely, i.e., hit some hotkey, have UE prompt me for my message, and then call the svn command line appropriately. Is this possible? I've set up a Tool Configuration to do the checkin, and currently use the %modify% token, but it's clunky because I have to edit the entire command line rather than just type my comment into a text box.

I know I can script a solution for this kind of thing in <your-favorite-scripting-language-here>, but was hoping for a cleaner solution than that.

Thanks for your thoughts.
jeblackburn
Newbie
 
Posts: 1
Joined: Fri Nov 13, 2009 10:01 am

Re: Prompt for Comment on SVN checkin

Postby StaticGhost » Wed Jan 20, 2010 11:13 pm

Hi jeblackburn,

This is what I do.

Make sure this is NOT selected: Menu bar > Advanced > Alternate Capture Method

Now to set up my SVN tasks..

This one will bring up Notepad so that I can write in my own comment (and then save Notepad and close it).
Menu bar > Advanced > Tool Configuration > click Insert > Command tab
- Menu Item Name: SVN commit and write comment
- Command Line: svn.exe commit %N%E --editor-cmd notepad.exe
- Working Directory: %p
Options tab
- Program Type: DOS Program
- Select Save Active File
Output tab
- Command Output (DOS Commands): Output to list box.
- Select Capture Output
- Replace selected text with: No Replace

I have another task called "SVN commit from UE" that uses a default commit message. The command line is:
svn.exe commit %N%E --editor-cmd notepad.exe -m "- Robert Mark Bram. Periodic update from UltraEdit."

Heaps more details about the SVN tasks I have set up on my blog post, "Subversion commit from Ultraedit": http://robertmarkbramprogrammer.blogspot.com/2010/01/subversion-commit-from-ultraedit.html

HTH

Rob
:)
User avatar
StaticGhost
Basic User
Basic User
 
Posts: 35
Joined: Sun Nov 21, 2004 12:00 am

Re: Prompt for Comment on SVN checkin

Postby StaticGhost » Fri Jan 22, 2010 8:15 am

Also, you can leave out
Code: Select all
--editor-cmd notepad.exe
if you set the SVN_EDITOR environment variable.

Interestingly, I tried setting SVN_EDITOR to UltraEdit, but it didn't work. SVN looks for the editor process to end before taking the contents of the file you have just edited as a comment for the checkin, and you just get an error if you try this with UltraEdit already open.

You can use the EDITOR variable on Windows instead (see http://www.svnforum.org/2017/viewtopic.php?p=28156#28156) which allows the use of a (multi tabbed) editor already in use, but this fails when launched from UltraEdit because SVN requires user input - which it can't get.

Some editors (like Notepad++) allow command line switches that will open a new instance. So I have SVN_EDITOR set to "notepad++ -multiInst", so that when I checkin through UltraEdit, a new instance of notepad++ is opened (just in case I happen to already have an instance open already).

Why do I bother? 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..

Rob
:)
User avatar
StaticGhost
Basic User
Basic User
 
Posts: 35
Joined: Sun Nov 21, 2004 12:00 am

Re: Prompt for Comment on SVN checkin

Postby Mofi » Fri Jan 22, 2010 8:57 am

Just a hint for StaticGhost: UltraEdit has also a switch to force a new instance, it is /fni which must be the first command line parameter (= first after the EXE name). For completeness, using /foi forces opening the file in the original (first) instance of UltraEdit if there are multiple instances running.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4049
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Prompt for Comment on SVN checkin

Postby StaticGhost » Fri Jan 22, 2010 4:22 pm

Mofi wrote:UltraEdit has also a switch to force a new instance, it is /fni which must be the first command line parameter

Nice one Mofi! So, either of these work ok (as long as you have their install directories in your path):
SVN_EDITOR="notepad++ -multiInst"
SVN_EDITOR="Uedit32.exe /fni"

Rob
:)
User avatar
StaticGhost
Basic User
Basic User
 
Posts: 35
Joined: Sun Nov 21, 2004 12:00 am

Re: Prompt for Comment on SVN checkin

Postby StaticGhost » Wed Jul 04, 2012 11:05 pm

I don't use command line SVN for this anymore - I use Tortoise SVN which has much better tooling for checkin dialogs etc. This was suggested by Daniel K, a commenter on one the blog post I wrote about this very post!

E.g. a commit:

Code: Select all
TortoiseProc.exe /command:commit /path:"%f" /closeonend:1

Or a diff:

Code: Select all
TortoiseProc.exe /command:diff /path:"%f" /closeonend:1

Rob
:)
User avatar
StaticGhost
Basic User
Basic User
 
Posts: 35
Joined: Sun Nov 21, 2004 12:00 am


Return to Custom User Tools/Tool Configuration