I have a 4 versions of a project. Versions 1-3 were "prototypes" that were originally not under source control (they exist as separate directories in the filesystem). Version 4 has been under source control since inception and now has a long history of commits.
I want to combine these so that versions 1-3 become individual changesets where each one is the descendant of the previous. The root of version 4 should become the descendant of version 3 (and no collapsing of version 4's history of course).
All changes are private, not public (there is no problem with rewriting history, as it were).
What I've done so far and tried:
1. I setup new hg repositories in the directory of the prototype versions
2. I cloned the repository of version 4
3. I pulled (with hg pull --force
) the unrelated repositories for versions 1-3 into the cloned repository.
This gives me 4 unrelated "roots" (changesets with no ancestors) in a single repository. When I combine them I don't want to remember these 4 roots. hg rebase
should let me move changesets and destroy the originals, unlike hg merge
.
Here I'll use 101
as the revision for "version 1" (which is a single changeset with no parent) and 102
as the revision for "version 2".
Attempt 1: I try hg rebase -b 102 -d 101
but get the respone nothing to rebase
. Presumably this is because they have no common ancestor (I feel like this is inconsistent... -b 102
would include all ancestors except the common ancestor, which would be nothing in this case.)
Attempt 2: I try hg rebase -s 102 -d 101
. This results in merge conflicts. I do hg revert --all --rev 102
and hg resolve -m
to indicate that I prefer "version 2" in all conflicts (although I wonder if that is really the right way to prefer one parent over another in the presence of adds/removes?). But when I commit, I don't have a linear history --- revision 102
is still there!