1
C:\Users\Itu\workspace\Compiler>hg branches
default                       13:aa6af82c5458

C:\Users\Itu\workspace\Compiler>hg heads
changeset:   13:aa6af82c5458
tag:         tip
user:        Itun
date:        Sun Sep 18 22:27:06 2011 +0400
summary:     Update 1.0.0.2

changeset:   9:d36e5ac454b1
parent:      -1:000000000000
user:        Itu
date:        Sun Sep 18 06:50:25 2011 +0400
summary:     New PR

changeset:   8:758cd394d82a
user:        Itun
date:        Sun Sep 18 06:48:17 2011 +0400
summary:     asdasd

changeset:   4:c4c981b4ff43
user:        Itun
date:        Sun Sep 18 03:31:58 2011 +0400
summary:     Update
C:\Users\Itu\workspace\Compiler>hg merge
abort: branch 'default' has 4 heads - please merge with an explicit rev
(run 'hg heads .' to see heads)

How you can see I have the one branch and 4 heads. When I try to pull in my eclipse mercurial plugin, it returns me message about multiple heads and offers me to rebase or merge. Then I did not understand anything and closed it. I think I need something to delete this heads. It would be great if somebody could explain me this and show how to do this in the eclipse plugin, but other help is appreciated.

kevingessner
  • 18,559
  • 5
  • 43
  • 63
itun
  • 3,439
  • 12
  • 51
  • 75

2 Answers2

5

The safest way to remove the extra heads is to make a new clone, grabbing just the head you want with -r:

cd C:\Users\Itu\workspace
mv Compiler Compiler-backup
hg clone -r aa6af82c5458 Compiler-backup Compiler 

This will move just aa6af82c5458 and its ancestors to the new clone, leaving the old heads in Compiler-backup. You can always hg pull them over later, or just delete the backup (losing your data).

kevingessner
  • 18,559
  • 5
  • 43
  • 63
  • But now I cannot synchronize this new repository with my remote repository. It wants to synchronize with Compiler-backup. – itun Sep 18 '11 at 23:59
  • Change your `[paths]` in `.hg/hgrc` in the new repo. – kevingessner Sep 19 '11 at 14:56
  • Yeah! Thanks. But there is another problem. When I call the pull, the remote repository again returns me this heads. How to delete this heads from the remote repository. – itun Sep 19 '11 at 18:23
  • Same deal: go the remote repository and do this same thing. You can also use the strip extension to do this in one command, but use it carefully. – kevingessner Sep 19 '11 at 21:09
  • Could you explain how to go to the remote repository. Everything I do in my console influence just at my local repository. I need a console of the server which store it. – itun Sep 20 '11 at 16:53
  • itun: Where is the remote repo stored? You'll need to use SSH, RDC, or what-have-you. – kevingessner Sep 22 '11 at 19:02
  • @itun bitbucket won't let you ssh into your repository, but you can strip a changeset from you repository admin. – kynan Jul 27 '13 at 17:56
3

Mercurial has an entire wiki page devoted to the topic of multiple heads.

I highly suggest reading it before proceeding on your apparent course of action.

The folks at Fog Creek have provided some friendlier material.

You might consider working with them, since it sounds like you might need some support.

Jeff Trull
  • 1,236
  • 11
  • 16
sylvanaar
  • 8,096
  • 37
  • 59
  • I had the similar answer here. But after two questions the user deleted it)). It does not work properly. Merge update my files but I do not need it. I need to delete this changesets and nothing more. – itun Sep 18 '11 at 22:59