Showing posts with label SVN. Show all posts
Showing posts with label SVN. Show all posts

Wednesday, 1 February 2012

Set SVN svn:externals In Command Line

Use this command if you wish to include the pysphere code inside your project repository:

svn propset svn:externals 'pysphere http://pysphere.googlecode.com/svn/trunk/' .

Note that dot at the end of the command and the quotes around the directory name and url.

Now commit with:
svn commit
and then update:
svn up
In order to set multiple directory/url pairs in a single svn:externals property, you should put the individual dir/url pairs into a file (let's call it 'svn.externals'), like so:
pysphere http://pysphere.googlecode.com/svn/trunk/
some_other_lib http://svn.some-other-lib.org/trunk/
and then apply the property using
svn propset svn:externals -F svn.externals .
You should also just check in 'svn.externals' to easily keep track of it.

You can also use:
svn propedit svn:externals .
an editor will open and you can add the external repositories, one per line, like this:
path/to/extenal http://url/of/repo

Possibly Related Posts

Thursday, 22 September 2011

SVN Dump Parts Of A Repository

Assuming the following SVN repo structure:
- repository root
| - project1
| - project2
| - project3
To dump the project1 history into a portable, re-creatable format, first you use svnadmin dump, like this:
svnadmin dump [path to repo] > repo.dump
Which creates a dump of the entire repository into a file called repo.dump. This might take some time and is CPU intensive so it would be best to perform this outside of normal work hours...
Then use svndumpfilter to filter just for the project1 folder (see folder tree above):
svndumpfilter include project1 < repo.dump > project1.dump
If you have nested repositories, then it breaks with a syntax error. To get around this you need to run the dump multiple times using the ‘exclude’ directive until you have what you want:
svndumpfilter exclude project2 < repo.dump >> project1.dump
svndumpfilter exclude project3 < project1.dump >> project1.dump
At the end you get a full svn repository that could be re-created anywhere, like this:
svnadmin create /var/svn/project1svnadmin load /var/svn/project1 < project1.dump
mkdir -p ~/workingcopies/project1svn co file:///var/svn/project1~/workingcopies/project1/

Possibly Related Posts

Sunday, 4 September 2011

Combining multiple SVN repositories into one

Assuming that
The existing repositories have a structure like:
- repository root
 | - branches
 | - tags
 | - trunk

and you want a structure something like:
- repository root
 | - projectA
   | - branches
   | - tags
   | - trunk
 | - projectB
   | - branches
   | - tags
   | - trunk

Then for each of your project repositories:
svnadmin dump > project<n>.dmp
Then for each of the dump files:
svnadmin load --parent-dir "project<n>" <filesystem path to repos>
More complex manipulations are possible, but this is the simplest, most straightforward. Changing the source repository structure during a dump/load is hazardous, but doable through a combination of svnadmin dump, svndumpfilter, hand-editing or additional text filters and svnadmin load

What about the revision numbering?
Let's assume that you have to repositories, one with HEAD revision 100 and the other with HEAD revision 150.

You dump the first repository and load it in the new one: you end up with the full story of the first repository, from revision 0 to revision 150.

Then you dump the second repository and load it in the new one: it gets loaded with its full history, the only things that change are the actual revision numbers. The history of the second repository will be represented in the new repository from revision 151 to revision 250.

The full history of both repositories is preserver, only the revision numbers change for the repository that is imported for second.

The same of course applies for more than two repositories.

Possibly Related Posts