Never Tell… Richard Eibrand


svn - moving part of repository to another repository

July 2nd, 2008 by Richard

I’ve recently had the pleasure of having to move part of a repository to another specific location within another repository, while needing to keep all the history. This had been a task that had been lurking around for a while at work, and in the past I had run into problems with svndumpfilter, and even svndumpfilter2 (including Bill’s modification).

As I had to revisit the problem, and get it working this time, I spent a little time at it. The end result is that it worked nicely, and in the spirit of sharing, I wrote up the procedure I carried out. You can find it below, and are welcome to share any comments and thoughts you have on this.

R

General procedure

  1. Dump svn repository or get a hold of already dumped repository (make sure no commits are being made at the time)

  2. Run svndumpfilter2 on the dump file, for this command, svndumpfilter2 must be available on the machine [1].

svnadmin dump /path/to/repo | svndumpfilter2 /path/to/repo folder_to_dump/subfolder > dump_file_name
Imagine the following scenerio, path/to/repo == /usr/svnrepo/project, folder_to_dump == trunk and subfolder == sample_code, the above line would read as follows
svnadmin dump /usr/svnrepo/projectname | svndumpfilter2 /usr/svnrepo/projectname trunk/sample_code > trunk_sample.dump
Note: in the above example, the folder_to_dump is mainly a top level folder, but you can also specify a subdirectory, e.g. folder_to_dump/subfolder/subsubfolder

3. Edit dump file to specify where the new dump is going to be imported, take special note of the sed expressions. This is needed to allow for easier importing into the destination repository. The svnadmin dump command will dump the repository, but it will dump it with the full path, so from our example above, this would be trunk/sample_code, and that is how it will be imported. But what if we want to import somewhere else than trunk? This is why we might need to edit the actual dump file.

Care must taken in this operation, as otherwise, the dump file may get partially corrupted, or generated an md5 checksum error, (see [2]).

A generic find/replace would be dangerous, as one might inadvertently edit the content of the code in the repository. To avoid this, our search must take into consideration both the Node-path: and Node-copyfrom-path parameters. This is shown in the example below.

The 1st part of our sed expression reads as follows:
sed -e “s/Node-path: trunk\/sample_code/Node-path: sample_code/g”
The 2nd part of our sed expression reads as follows:
sed -e “s/Node-copyfrom-path: trunk\/sample_code/Node-copyfrom-path: sample_code/g”
The output of the these sed commands is then piped into a new file, ready for importing, see below:

#renaming path of where the file will end up - sed complicated but this is because of md5-error
cat trunk_sample.dump | sed -e “s/Node-path: trunk\/sample_code/Node-path: sample_code/g” | sed -e “s/Node-copyfrom-path: trunk\/sample_code/Node-copyfrom-path: sample_code/g” > cleaned_trunk_sample.dump



4. Load new dump file into destination repository (make sure no commits are being made at the time). In the example shown below, we are importing our sample_code into a subdirectory of trunk in our new directory. This directory needs to exist prior to executing the svnadmin load command.

sudo svnadmin load /usr/svnrepo/new_projectname –ignore-uuid –parent-dir trunk/server < cleaned_trunk_sample.dump > repo_import.log

The above command will import the samplecode part of original repository into the trunk/server/samplecode, with all the history from the previous repository where the sample_code resided.

References

[1] svndumpfilter2 url: http://svn.tartarus.org/svn-tools/ using version 8055 http://svn.tartarus.org/checkout/svn-tools/svndumpfilter2?rev=8055

[2] md5 mismatch - good tips here and helped me in my procedure http://blog.fredrikbostrom.net/2007/03/14/migrating-part-of-repository-in-svn Read the rest of this entry »

Posted in general, infrastructure, svn | No Comments »

links for 2008-03-30

March 30th, 2008 by Richard

Posted in general | No Comments »

Freeze Improv

March 23rd, 2008 by Richard

On Saturday, had a bit of fun. I went to Dundrum, stood frozen in motion for 5 minutes - while people were walking by and wondering what was going on… Great fun.

There were more people involved, but it was quite difficult to film other people while standing still! When you watch the video, check out the look on the faces of the people walking past ;) Check out the background of the vid as well, you should be able to spot other people standing still.

R

Read the rest of this entry »

Posted in general | No Comments »

links for 2008-03-17

March 17th, 2008 by Richard

Posted in general | No Comments »

links for 2008-03-13

March 13th, 2008 by Richard

Posted in general | No Comments »

links for 2008-03-05

March 5th, 2008 by Richard

Posted in general | No Comments »

links for 2008-02-29

February 29th, 2008 by Richard

Posted in general | No Comments »

links for 2008-02-22

February 22nd, 2008 by Richard

Posted in general | No Comments »

links for 2008-02-20

February 20th, 2008 by Richard

Posted in general | No Comments »

links for 2008-02-13

February 13th, 2008 by Richard

Posted in general | No Comments »

links for 2008-02-06

February 6th, 2008 by Richard

Posted in general | No Comments »

links for 2008-02-05

February 5th, 2008 by Richard

Posted in general | No Comments »

alive and well

January 28th, 2008 by site admin

Hi all,

Apologies for not getting more updates to the site - but the great hopes I had for telecommunications along the way did not pan out.

I will be home shortly, and I hope to be able to give a good roundup of the last number of weeks - a lot has happened, that’s for sure.

Until then, a warm goodbye from Sunny Gambia!

R

Posted in general | 1 Comment »

the trip…

January 2nd, 2008 by Richard

And to start off, Happy New Year to you all.

This short(’ish) - post is just to let you know of a little trip that I am about to embark on with some friends.

The short version: Myself and two friends are going to take a 27 year old Mercedes Benz 280CE all the way to The Gambia. Why? For fun - and also for charity, as after we have arrived in Banjul in The Gambia, the car will be auctioned off and all proceeds will be going to a local charity organisation.

This trip is also known as the Plymouth-Banjul challenge.

A Mayo News Article can be found here:

Information: The main site with information regarding the challenge can be found here:

Pictures of our car here

One of two pages that I hope I will be update en route with some information from the trip here and here

An approximate route and timeline of where we will be can be found here

I have no idea if I will be able to post during the trip, but if I can - I will (maybe)

So until February some time - have a good one, and I’ll see you then ;)

R

Map below will hopefully show our progress during the trip… Otherwise check out this link


View Larger Map

Posted in general | 1 Comment »

links for 2007-12-25

December 25th, 2007 by Richard

Posted in general | No Comments »

links for 2007-12-21

December 21st, 2007 by Richard

Posted in general | No Comments »

links for 2007-12-17

December 17th, 2007 by Richard

Posted in general | No Comments »

links for 2007-12-12

December 12th, 2007 by Richard

Posted in general | No Comments »

links for 2007-11-27

November 27th, 2007 by Richard

Posted in general | No Comments »

links for 2007-11-26

November 26th, 2007 by Richard

Posted in general | No Comments »

« Previous Entries