How do you divide a repository?
Joris Putcuyps
joris.putcuyps at skynet.be
Fri Apr 14 20:03:48 BST 2006
John Arbash Meinel wrote:
> Joris Putcuyps wrote:
>
>> Hello
>>
>> Is there a way to devide a big repository into parts and keep the
>> history?
>>
>> Joris
>
>
> The easiest way to split a branch is:
>
> # Create a new branch which will just hold part of the stuff
> $ bzr branch complete-project just-lib1
> $ cd just-lib1
> # Remove all the other stuff you don't want
> $ rm -rf other-stuff1 other-stuff2
> # Move the stuff you do want to the top-level directory
> $ bzr mv dir/to/lib1/* .
> # And get rid of other stuff
> $ rm -rf dir/to/lib1
>
> $ bzr commit -m "Pruning the tree down to just lib1"
>
>
> Now you have a branch, which only has the files for lib1. There are good
> and bad things to say.
>
> First, you can pick one direction, wherin merges will be easy. (So if
> you will always merge from complete-project => lib1, or if you always
> merge from lib1 => complete-project).
>
> The downside is that at present bzr won't let you merge both ways very
> easy. Because to bzr, it will always look like you either deleted a
> bunch of files, or created a bunch of files, and it will want to
> propogate that change.
>
> I've done this on my stuff, and I add one more step, which is:
>
> $ cd ../complete-project
> # Pretend like you are merging the lib1 project
> $ bzr merge ../just-lib1
> # Remove all of the actual changes, but keep the 'pending-merge'
> # 'bzr revert *' says revert all of the changes to these files,
> # but it doesn't revert the metadata
> $ bzr revert *
> $ bzr commit -m "Fake merge from lib1"
>
> At this point, you can make changes to 'lib1' and merge them into
> 'complete-project' without any problems. You can also 'cherrypick'
> changes from 'complete-project' to apply them to 'lib1', using a second
> argument to --revision. For example:
>
> $ cd just-lib1 ; bzr merge -r 10..11 ../complete-project
>
> bzr doesn't remember cherry-picks, though, so they are a little more
> difficult to use.
>
> Does this help, or did I give you too much info?
>
> John
> =:->
>
>
Thx, I don't need merging into the complete-project, so that won't be a
problem.
Your solution will work for creating a new project with history for
those files, but I think if your '.bzr' directory kinda big you will
also have that big history in your small library :(
Joris
More information about the bazaar
mailing list