pruning history from branch - rebase?
John Arbash Meinel
john at arbash-meinel.com
Fri Mar 20 23:24:30 GMT 2009
-----BEGIN PGP SIGNED MESSAGE-----
David Reitter wrote:
> I'm looking for a bit of advice on how to combine about 15 years worth
> of changes in an active upstream project into just one revision within
> my downstream branch, i.e.
> combining revisions 1..80000 or so into a single one.
> I understand (from ) that rebase should be able to do this. 
> lists a recipe that I will try to follow.
> My question is:
> - Will I be able to merge new revisions taking place in the upstream
> branch easily into mine? (Logically I don't see a problem.)
> - Will I be able to push changes in my branch upstream, or at least
> generate working merge bundles?
> - David
> PS.: It would be nice if rebase provided a command to do this. Also,
> can I suggest to improve the explanation of the "-r" argument of "bzr
> rebase" in its --help text?
I'm not sure I understand what you are thinking about combining 80k
revisions, but conceptually:
bzr commit -m "initial null revision"
bzr merge -r0..-1 ../big-project
bzr revert --forget-merges
Will merge the current content of the files, and not the actual
ancestry. Though this is much easier to achieve with:
bzr export ../tiny-project
bzr add --file-ids-from ../big-project
bzr commit -m "Initial snapshot of 'big-project'"
At this point, you have a tree with all the same file ids, but none of
Merging will be an issue, because all of these files don't share any
ancestry yet. If you just want to be able to commit locally, and merge
that into big-project, you could do:
bzr merge -r 0..-1 ../tiny-project
# This should actually do very little to your working tree, as long as
# you do it with the exact version that you exported.
# the merge algorithm should notice that all the content is identical,
# and allow clean resolutions of introducing identical content
bzr commit -m "bring in the first rev of tiny-project"
Now the two ancestry graphs have joined, and you can trivially merge all
of the changes from 'tiny-project' into 'big-project'.
Note that the *reverse* is not 100% true. Specifically, tiny-project has
none of the ancestry of big-project. If you want to merge from
big-project back into tiny-project, you have to use a 'cherry-pick' to
do so (assuming you don't want to actually ever bring in the rest of the
ancestry of big-project, which I assume was the whole point of the
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
More information about the bazaar