Put your junk in the trunk: “Moving” a subversion repo into the trunk

This post gives you the Windoze commands because this was something I worked on for my Office.

We have a project.  Let’s call it project1.  When the repo for the project was initially created it was not created with branches, trunk, and tags folders in the root.  Going forward, everything was just committed to the root instead of to the trunk folder.  Well, now we want to follow best practices and begin committing to the trunk.  We don’t want to lose any of our repo history in the process though if we have to do re-creations of the repo.

We tried to do an svn mv, but you can’t move a repo to a path within the repo.  So here’s what we did.

  1. Make a dump of the current repo
    svnadmin dump c:\Repositories\myproject1\ > c:\myproject1.dump
  2. Delete  the current repo (I’m assuming you have a backup if something goes wrong.  You do, don’t you?).
    rmdir c:\svn\myproject1
  3. Recreate the repo.  This time let’s be sure to make branches, trunk, and tags folders in the root.
    svnadmin create c:\Repositories\myproject1
    svn mkdir trunk
    svn mkdir branches
    svn mkdir tags
  4. Load the dump into the trunk (Gross):
    svnadmin load c:\Repositories\myproject1\ --parent-dir trunk < c:\myproject1.dump

There it is.

You might also give this a try: http://chipcastle.blogspot.com/2008/08/subversion-forgot-to-create-trunk.html

Rename a Subversion Repository

The scenario: You have a folder called code-repo where you keep all your svn repositories (let’s assume it is located in the root c:/ on a Windoze system).  You have a repository named xproject.  For some reason you need to rename the repository.  Let’s say it needs to by yproject.  There are 3 steps to rename the repository and retain all the history you have in the repo.

  1. Create an svn dump file of the xproject repo: svnadmin dump C:\code-repo\xproject > c:\xproject.dmp
  2. Create the new yproject svn repo: svnadmin create C:\code-repo\yproject
  3. Load the dump of the old repository into the new one: svnadmin load C:\code-repo\yproject < C:\xproject.dmp


CS4 Beta – Subversion integration does not support file:// protocol

CS4 Beta has no love for svn file:// protocol

I was really excited to see that CS4 was integrating Subversion.¬† In fact it was the main reason I downloaded the CS4 Beta.¬† At my office I am the only programmer and you’ll have to trust me when I say my only option (for a wide variety of reasons beyond my control) is Subversion on my local machine’s file system and not as a Subversion Server.

Sadly, here is the error message that tipped me off that the file:// protocol was not a possibility:

You have entered non-matching protocols.  Please check your settings.

I’m not the only one hoping for Adobe to add support.¬† Check this post as well.¬† If anyone knows of or hears about this getting changed in future releases please drop me a note.

SVN Global Ignore Pattern

Here is an SVN Global Ignore Pattern that you might find useful:

._* .project .DS_Store Thumbs.db WS_FTP.LOG _notes _vti_* *.LCK

You implement it in the Windows world using TortoiseSVN’s settings tab. It looks like this:

For the mac you need to edit subversion’s config file:

pico ~/.subversion/config

Uncomment the global-ignores line and modify it to look something like this:

global-ignores = ._* .project .DS_Store Thumbs.db WS_FTP.LOG _notes _vti_* *.LCK _sources

Subversion backup of multiple repositories via DOS .bat file

I recently had to implement Subversion at work to manage our source code. Part of that implementation was coming up with a way to automate the backup process. Since developers could be accessing code repositories at any time there is a special command (called hotcopy) in Subversion for copying a repository to another location, which you can then backup to disk, tape, etc.

I started out just doing a simple DOS .bat file to run the hotcopy. My plan was to schedule this to run in the Windows scheduler prior to the nightly backup. As I started working on the script though I found myself trying to improve it to be as generic and hands off as possible. I also wanted to backup multiple repositories.

Here are some “features” of the script:

  • It will hotcopy multiple repositories in a specified directory.
  • It can be run attended or unattended
  • It has some basic log functionality

Here is a look at the actual hotcopy command in the .bat file:
ECHO Starting SVN backup for %%G... >> %repolog% & ^
svnadmin hotcopy %repodir%%%G %repodirhot%%%G --clean-logs >> %repolog% & ^

Download it here and rename it from svn_backup.txt to svn_backup.bat.

Subversion on Ubuntu (Feisty) with a Mac Client

Subversion gets my ducks in a row

As part of a continuous effort to improve my organization (a.k.a. not lose stuff) I have finally set up Subversion at home. If you are not familiar with Subversion it is an open source version control system used (mostly) by developers to keep up with changes to their codebase.

I’ve spent most of my career as kind of a “one man team” where I have been responsible for all phases of development and maintenance of code. However, I was exposed to Subversion when I contracted briefly last year in a multi-developer environment. I made a mental note at that time to revisit Subversion at a later date.

At last that date has come…

Subversion is now running at home on an old Gateway pc that I recently “upgraded” from XP to Ubuntu. I’m a total newbie with Linux, but I’ll be posting some on it in the future. Thanks to this tutorial the process was ridiculously easy (less than 5 minutes).

The next step was to get an SVN client. My previous exposure to Subversion was in the Windows world so we used TortoiseSVN. I have a PowerBook and an iMac at home though so I hunted down scplugin which integrates with Mac Finder the way TortoiseSVN integrates with Windows Explorer.

Now I just have to get all my code checked in.