Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The Situation

I am running bazaar 2.4.1

A 'project hosting' company hosts my svn repository for Project A at:

https://svn.example.com/myrepo/trunk/ProjectA/

I do not have svn-admin access to the repo at svn.example.com.

Within the projectA repo, there is a directory that holds all the code for Component X. Its svn location is:

https://svn.example.com/myrepo/trunk/ProjectA/ComponentX

The Goal

I am trying to split off Component X from Project A's SVN repo to become Project B. Where Project B is versioned in Bazaar.

The Plan

My plan is to:

  1. Create a local bzr repository for Project B
  2. Use bzr svn-import to import Component X from Project A into my local Project B
  3. Then, push Project B to Launchpad
  4. Then, svn-delete the old Component X direcotry from the svn repo.

I am stuck at step 2.

So far so good

So, on my Windows XP, I have created a bzr repo for Project B:

# cd C:\me\OpenSource\
# bzr init-repo ProjectB

Then, I moved into that directory:

# cd ProjectB

It goes a bit wrong

Then, I tried to bzr svn-import to grab the svn directory:

# bzr svn-import https://svn.example.com/myrepo/trunk/ProjectA/ComponentX/

This, however, generates an error:

bzr: ERROR: The specified path is inside a branch. Specify a different URL or a
different repository layout (see also 'bzr help svn-layout').

I have tried various things and keep getting the same error.

Things I have tried

Tried: Modifying subversion.conf to indicate that ComponentX is a branch

After looking at 'bzr help svn-layout', I have modified C:\Documents and Settings\Me\Application Data\bazaar\2.0\subversion.conf and added a line to indicate that /ComponentX should be treated as a branch:

[203ae883-c723-44c9-aabd-cb56e4f81c9a]
branches = */ComponentX

That did not work. Same error:

bzr: ERROR: The specified path is inside a branch. Specify a different URL or a
different repository layout (see also 'bzr help svn-layout').

Tried: Specifying a different repository layout as an argument

i.e. passing it as an argument: --layout=root (Because I wanted that path to be treated as root of the new bzr repo):

# bzr svn-import --layout=root https://svn.example.com/myrepo/trunk/ProjectA/ComponentX/

That did not work. Same error:

bzr: ERROR: The specified path is inside a branch. Specify a different URL or a
different repository layout (see also 'bzr help svn-layout').

So, I tried just saying --layout=none:

# bzr svn-import --layout=none https://svn.example.com/myrepo/trunk/ProjectA/ComponentX/

That did not work. Same error:

bzr: ERROR: The specified path is inside a branch. Specify a different URL or a
different repository layout (see also 'bzr help svn-layout').

To be honest I'm hacking now.

I just do not know where I am going wrong.

share|improve this question
up vote 1 down vote accepted

svn-import is specifically targetted at importing all branches in a Subversion repository. The --layout option is used to specify what it considers a branch. It seems you're trying to clone a single branch, for which "bzr branch" is indeed the correct command.

To explain the layouts:

Asterisks in the "branches = " setting don't traverse more than one level of directories. Setting "branches = trunk/*/ComponentX" in subversion.conf would be the correct value. It seems like the error from bzr-svn is a bit confusing though. Really, it should be saying that the path you've specified doesn't contain any branches.

This means that --layout=root will merely make it consider https://svn.example.com/myrepo a branch. This explains why you get the error about specifying a branch inside of a path.

share|improve this answer
    
Thanks, thats really helpful. – JW. Nov 11 '11 at 2:28

In answer to my own question.

Instead of battling with bzr svn-import, circumvent the problem by using bzr branch instead. It does not really answer the questions why bzr svn-import is throwing errors, but solves the problem.

So, in the situation where a 'project hosting' company is hosting your svn repository for Project A at:

https://svn.example.com/myrepo/trunk/ProjectA/

and within the projectA repo, there is a directory that holds all the code for Component X. Its svn location is:

https://svn.example.com/myrepo/trunk/ProjectA/ComponentX

and where the goal is to split off Component X from Project A's SVN repo to become Project B. Where Project B is versioned in Bazaar.

The plan should be to:

  1. Create a local bzr repository for Project B
  2. Use bzr branch to dump Component X from Project A into my local Project B
  3. Then, push Project B to Launchpad
  4. Recommended: Don't forget to svn-delete the Component X from Project A to avoid duplication.

Like so:

1. Create a local bzr repository for Project B

So, on my Windows XP, I create a bzr repo for Project B:

# cd C:\me\OpenSource\
# bzr init-repo ProjectB

Then, move into that directory:

# cd ProjectB

2. Use bzr branch to dump Component X from Project A into my local Project B

Then, create a local branch from the svn repo sub-directory:

# bzr branch https://svn.example.com/myrepo/trunk/ProjectA/ComponentX/ ComponentX

3. Then, push Project B to Launchpad

Then, push it to create the launchpad-hosted branch as per the instructions in the bazaar docs:

# bzr push lp:~mylaunchpadteam/mylaunchpadproject/trunk

Then, perhaps tweak the directory structure and add files to convert it into a 'project'.

share|improve this answer
    
to be honest, i'd have just used svn export and thrown away the revision history, and done a bzr add *; bzr push. – Sirex Nov 10 '11 at 10:06
    
Yes. It would be simpler if you didn't want to hoard the revision history. – JW. Nov 10 '11 at 11:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .