<p>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.</p>

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

[{'answer_id': 67126, 'author': 'jamuraa', 'author_id': 9805, 'author_profile': 'https://Stackoverflow.com/users/9805', 'pm_score': 0, 'selected': False, 'text': "<p>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. </p>\n\n<p>you will end up with something like: </p>\n\n<pre><code>branch project:\n.. other files.. \nframework/a.file\nframework/b.file\nframework/c.file\n\nbranch framework: \na.file\nb.file\nc.file\n</code></pre>\n"}, {'answer_id': 122592, 'author': 'Daniel Schierbeck', 'author_id': 20321, 'author_profile': 'https://Stackoverflow.com/users/20321', 'pm_score': 0, 'selected': False, 'text': '<p>As far as I know, "nested" branches are not support by Bazaar yet. Git supports "submodules", which behave similar to Subversion externals.</p>\n'}, {'answer_id': 138836, 'author': 'Jrgns', 'author_id': 6681, 'author_profile': 'https://Stackoverflow.com/users/6681', 'pm_score': 4, 'selected': True, 'text': '<p>You use the split command:</p>\n\n<pre><code>bzr split sub_folder\n</code></pre>\n\n<p>This creates an independant tree in the subfolder, which you can now export and work on separately.</p>\n'}, {'answer_id': 427077, 'author': 'thomasrutter', 'author_id': 53212, 'author_profile': 'https://Stackoverflow.com/users/53212', 'pm_score': 0, 'selected': False, 'text': "<p>I have tried doing this with bzr split, however, this does not work how I expect.</p>\n\n<ul>\n<li>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.</li>\n</ul>\n\n<p>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.</p>\n\n<p>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).</p>\n\n<p>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.</p>\n"}, {'answer_id': 596656, 'author': 'bialix', 'author_id': 65736, 'author_profile': 'https://Stackoverflow.com/users/65736', 'pm_score': 3, 'selected': False, 'text': '<p>Use fast-import plugin (<a href="http://bazaar-vcs.org/BzrFastImport" rel="noreferrer">http://bazaar-vcs.org/BzrFastImport</a>):</p>\n\n<p>1) Export all your history to the stream:</p>\n\n<pre><code>bzr fast-export BRANCH &gt; full-history.fi\n</code></pre>\n\n<p>2) Filter the history to produce new stream:</p>\n\n<pre><code>bzr fast-import-filter -i subfolder full-history.fi &gt; subfolder.fi\n</code></pre>\n\n<p>3) Recreate new branch with subfolder only:</p>\n\n<pre><code>bzr init-repo .\nbzr fast-import subfolder.fi\n</code></pre>\n'}, {'answer_id': 6299487, 'author': 'freegnu', 'author_id': 133000, 'author_profile': 'https://Stackoverflow.com/users/133000', 'pm_score': 0, 'selected': False, 'text': "<p>Do a</p>\n\n<pre><code>bzr init .\nbzr add .\nbzr commit\n</code></pre>\n\n<p>in the framework directory.</p>\n\n<p>Then you can branch and merge to just that directory.</p>\n\n<p>The bazaar higher up will ignore that directory until you do a join.</p>\n\n<p>Bazaar understands when you do things like</p>\n\n<pre><code>bzr branch . mycopy\nbzr branch . myothercopy\n</code></pre>\n\n<p>The current directories .bzr won't track those subdirectories changes.</p>\n\n<p>It saves you from trying to find a place to put a branch.</p>\n"}]
['https://Stackoverflow.com/questions/67021', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6681/']