tags:

views:

489

answers:

5

I'm coding a framework along with a project which uses this framework. The project is a Bazaar repository, with the framework in a subfolder below the project.

I want to give the framework a Bazaar repository of its own. How do I do it?

A: 

As far as I know, there is not a way to do this easily with bazaar. One possibility is to take the original project, branch it, and then remove everything unrelated to the framework. You can then move the files in the subdir to the main dir. It's quite a chore, but it is possible to preserve the history.

you will end up with something like:

branch project:
.. other files.. 
framework/a.file
framework/b.file
framework/c.file

branch framework: 
a.file
b.file
c.file
jamuraa
A: 

As far as I know, "nested" branches are not support by Bazaar yet. Git supports "submodules", which behave similar to Subversion externals.

Daniel Schierbeck
+2  A: 

You use the split command:

bzr split sub_folder

This creates an independant tree in the subfolder, which you can now export and work on separately.

Jrgns
A: 

I have tried doing this with bzr split, however, this does not work how I expect.

  • The resulting branch still contains the history of all files from all original directories, and a full checkout retrieves all the files. It appears the only thing that split does is convert the repository to a rich root repository so that this particular tree can be of a certain subdirectory only, but the repository still contains all other directories and other checkouts can still retrieve the whole tree.

I used the method in jamuraa's answer above, and this was much better for me as I didn't have to mess with converting to a new repository type. It also meant that full checkouts/branching from that repository only recreated the files I wanted to.

However, it still had the downside that the repository stored the history of all those 'deleted' files, which meant that it took up more space than necessary (and could be a privacy issue if you don't want people to be able to see older revisions of those 'other' directories).

So, more advice on chopping a Bazaar branch down to only one of its subdirectories while permanently removing history of everything else would be appreciated.

thomasrutter
+1  A: 

Use fast-import plugin (http://bazaar-vcs.org/BzrFastImport):

1) Export all your history to the stream:

bzr fast-export BRANCH > full-history.fi

2) Filter the history to produce new stream:

bzr fast-import-filter -i subfolder full-history.fi > subfolder.fi

3) Recreate new branch with subfolder only:

bzr init-repo .
bzr fast-import subfolder.fi
bialix