Is this possible?
John Arbash Meinel
john at arbash-meinel.com
Wed May 7 19:24:16 BST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Matthew D. Fuller wrote:
| On Wed, May 07, 2008 at 05:02:36PM +0000 I heard the voice of
| Neil Martinsen-Burrell, and lo! it spake thus:
|>> Or perhaps this is a sufficiently common thing that someone
|>> already has the program?
|
| It seems like a natural extention to rebase; that's essentially what
| you're doing after all, you're just rebasing part of the tree and
| ignoring the rest. I don't know if anybody's even sketched out what
| it would take to add filtering capability to rebase.
|
|
|> Try the ``bzr split`` command. Judging by the help, it does what
|> you want.
|
| The problem with split is that it doesn't rewrite any history, so if
| you step back to the commits before the one where it's split, the
| whole tree is there. That's unpleasant if your goal is to not be
| carrying about the weight of all the history, and disastrous if your
| goal is to be able to publish part of the tree while the rest has to
| remain closely held.
|
|
It depends what you want to be considered "preserving history". It is a loaded
term that implies several different things.
Right now, you can do:
~ bzr branch whole_project just_subdir
~ cd just_subdir
~ bzr rm LOTS OF STUFF
~ bzr mv subdir/* .
~ bzr commit -m "splitting out project into just subdir"
Which is effectively what "bzr split" is doing. 'bzr split' is mostly
experimental work for NestedTreeSupport, which means you have to "bzr upgrade
- --development-subtree", and is not really recommended (yet).
So the *good* of doing the above:
1) History is preserved for "bzr log", "bzr annotate" and interestingly enough
"bzr merge".
2) If you take 1 small step further, you can actually merge back and forth
between the projects, though merging into the subdir project has to be done with
cherrypicks. Specifically you need to do:
~ cd whole_project
~ bzr merge ../just_subdir
~ bzr revert . # Revert the file changes, but not the merge pointer
~ bzr commit -m "merging just subdir"
At that point, if you do further work in the "just_subdir" branch, you can
easily merge those back into "whole_project" with just plain "bzr merge
../just_subdir". It will track what exists in whole_project, and only merge in
the new stuff.
If you make changes in "whole_project" and want them in "just_subdir" then you
will want to "bzr merge -r X..Y" to just merge a small subset of the changes.
(Otherwise it would try to merge the other files in "whole_project" into your
"just_subdir" branch.)
The *bad*:
1) It still has the whole history of the project up to the point you split off.
Which means you don't save space for "bzr branch", and means if you "bzr revert
- -r XXX" you'll get the whole project back.
Which is an accurate representation of history, but may not be what you want.
2) That also includes any secrets that you are trying to hide.
Another possible way of doing it is to use:
bzr fast-export > dump.txt
filter dump.txt
bzr fast-import < dump.txt
I haven't done this myself, but I'm told it should recreate what you want. You
now have a completely separate project (so merging between them is not possible
without some pain). It means your secrets are hidden, and a branch of it will
only have to download the subset of data that actually effects those files.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkgh89AACgkQJdeBCYSNAANWLgCffg59FqZjjM8m9Tqj3YSd2zZQ
tFcAoJ8MB6KZj5kayKP2sZcBf6JskZDd
=zXUu
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list