two heads have no common ancestor

Scott Palmer swpalmer at gmail.com
Fri Jan 31 17:23:56 UTC 2014


I just did this intentionally as well and I wonder if I shouldn't have.
 Two colleagues mis-communicated and started on the same project
independently, both committing revision 0 to separate repos.  When one of
them went to commit to a shared repo Mercurial correctly claimed it was
unrelated.  I forced things knowing full well that it would create two
roots and the merge went fine.

But am I asking for trouble?  It's early so history and hashes don't matter
to me yet. I can start a new repo with a single root if that is going to
save me some headaches in the future.  Should I?

Scott



On Fri, Jan 31, 2014 at 11:56 AM, Eric Siegerman <pub08-hg at davor.org> wrote:

> On 01/30/2014 03:38 PM, D Wang wrote:
> > I have a repo where the two heads have no common ancestor [...]
>
> Another way to get this is by pulling from an unrelated repository. By
> default, "hg pull" will refuse to do that, but "--force" overrules its
> objection.  Same goes for pushing to an unrelated repo (--new-branch still
> refuses, as it should; you have to use --force).
>
> I've had occasion to do this on purpose, to combine two previously
> independent histories.  "hg pull --force" to get both histories into one
> repo, then merge corresponding heads to get both file trees into one
> changeset.
>
> After "hg pull --force" your history looks like this (I've deleted the
> user: and date: lines for brevity):
>     o  changeset:   5:cb6d5b3e1c05
>     |  tag:         tip
>     |  summary:     A, cadabra
>     |
>     o  changeset:   4:65a499bbce55
>        parent:      -1:000000000000
>        summary:     A, abra
>
>     @  changeset:   3:26e5ea35a562
>     |  summary:     B, fum
>     |
>     o  changeset:   2:763db58de35d
>     |  summary:     B, foe
>     |
>     o  changeset:   1:d6d1b5acfc47
>     |  summary:     B, fie
>     |
>     o  changeset:   0:54a4b8e81ca5
>        summary:     B, fee
>
>
> After merging it looks like this:
>     @    changeset:   6:5e7cc364ed2c
>     |\   tag:         tip
>     | |  parent:      3:26e5ea35a562
>     | |  parent:      5:cb6d5b3e1c05
>     | |  summary:     Merge magics
>     | |
>     | o  changeset:   5:cb6d5b3e1c05
>     | |  summary:     A, cadabra
>     | |
>     | o  changeset:   4:65a499bbce55
>     |    parent:      -1:000000000000
>     |    summary:     A, abra
>     |
>     o  changeset:   3:26e5ea35a562
>     |  summary:     B, fum
>     |
>     o  changeset:   2:763db58de35d
>     |  summary:     B, foe
>     |
>     o  changeset:   1:d6d1b5acfc47
>     |  summary:     B, fie
>     |
>     o  changeset:   0:54a4b8e81ca5
>        summary:     B, fee
>
>
>   - Eric
>
>
> _______________________________________________
> Mercurial mailing list
> Mercurial at selenic.com
> http://selenic.com/mailman/listinfo/mercurial
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20140131/934e5669/attachment-0002.html>


More information about the Mercurial mailing list