Merge from old repo to new one?

Joshua Judson Rosen rozzin at hackerposse.com
Fri Aug 5 16:38:43 UTC 2016


On 08/03/2016 05:58 AM, Alexander Belchenko wrote:
> 2016-08-02 19:12 GMT+03:00 <ckalisiak at attotech.com <mailto:ckalisiak at attotech.com>>:
>>
>> But I can't figure out how to merge from the old repository to the
>> new. Bazaar can't figure out the base revision of the launching
>> point, which is understandable, but I can't figure out a way to tell
>> the merge operation what to use as a basis. When I specify a merge
>> range, say, 242..243, it treats everything as a conflict, and starts
>> renaming directories in the new repository.
>
> What do you mean by "renaming directories"? Do you end up with bunch of ".moved" files and directories or different case?
> 
> Are you aware of preserving file IDs for new repository?

I think what he means is that he's done something like this:

	bzr init new
	bzr cp -a old/* new/
	bzr add new/
	bzr commit new

... and then when he does this:

	bzr merge -d new old

... and then he's getting surprised by the fact that every file
merged into new from old appears as a "new file" which conflicts
with a pre-existing file of the same name/path.

This is of course because the *re-init from scratch* allocated all
different file-IDs for everything; I think this is kind of an anti-pattern....

If you really want to throw away all of incremental revision-history,
don't re-init from scratch, just do this:

	bzr uncommit -r0
	bzr commit

But be aware that, if you do then want to merge from another branch
with `un-squashed' history, your merges will need to be much more
`intentional': by default "bzr merge" will just refuse to operate;
you can force it to merge the whole history by being explicit about that
("bzr merge -r0.."), but that's presumably not what you want if you're
squashing down your entire history in the first place.

If you do cherry-pick merges (as described) from "old" (unsquashed)
to "new" (squashed) that should do what you're expecting: generate diffs
between the cherry-pick points and apply them _without_ importing parts
of the DAG from the "old" branch into the "new"--assuming that you've
preserved the file-IDs between the branches :)

-- 
"Don't be afraid to ask (λf.((λx.xx) (λr.f(rr))))."



More information about the bazaar mailing list