Using WinSCP to edit and work with remote SVN repositories.


For those of you without the option to use Coda (Mac) to work efficiently with remote files it is possible to remotely edit files using WinSCP then commit the files to SVN.

Summary: I work a lot with Puppet, a configuration tool for Linux, Unix and others. This is essentially a large number of text files in a repository pushed out by a server to client machines. This is a great system for controlling what goes onto machines however it provides no form of tracking with regards to who made what change and when to the config files. As such I have committed the entire puppet directory to an SVN repository with the puppet server periodically checking out the latest version, this prevents accidental changes and forces checkins.

Coda allows you to work with these files quite easily and clearly control when you have edited files and push them to both SVN and the Puppet Server. Both tasks, the push and the commit are important as without the push the puppet server will take a large amount of time to refresh the file and without the commit and file that is pushed will be eventually overwritten. I have been unable until now to find a workable solution for Windows Admins to work well with this system.

Below is how to implement WinSCP in a configuration that will let you remotely edit a file then right click and commit the file. It depends on the user you are logging in as to have rights to edit/commit etc obviously.

Once done multiple SVN users should be able to log in and make changes to the same repository and have their edits correctly recorded and saved. Options such as changing to your favourite editor are not shown, just enough to have SVN working.

Firstly open WinSCP:

From there key in your hostname, username and if you want your password. Click the preferences.

Depending on your source layout you may find it easier to work in explorer mode as this will effectively display the full directory tree. Select Preferences again.

In the preferences window select “commands” on the left hand side, select “Add …” (In the image above I have already added SVN Commit and SVN Revert)

Enter your description and the above custom command. This command will commit the file (file name expanded from the ! character). I like to have results shown as with multiple concurrent users it isn’t always guaranteed that your commit will work.

Now right clicking a file will allow you both to edit it locally and then easily commit the file to SVN!
Tagged as: ,
Comments (0) Trackbacks (0)

No comments yet.

Leave a comment

No trackbacks yet.