New remote head when pushing a new branch

I created a named branch in mercurial, made some changes, and now I want to push this back to the central repo. I made a selection, confirmed that I have no changes to merge, but when I try to push, I get the message push creates new remote head , but I do not understand why. I am the only developer in this thread and it is still local to my repository.

 >hg fetch (pull/update/merge) >hg status (shows nothing) >hg push --new-branch mybranch searching for changes new remote heads on branch 'default' new remote head c3064f3cf1b7 abort: push creates new remote head c3064f3cf1b7! (did you forget to merge? use push -f to force) 

Any ideas?

Edit : sorry for any confusion, this is a named branch created by hg branch mybranch

Update : Using hg heads gives several chapters in different branches. I have one for my branch and one by default:

 changeset: 515:97b9a7802751 branch: mybranch user: me < me@mymail.com > date: Mon Feb 27 13:21:54 2012 -0800 files: CryptoRandom.cs description: fixing error message for size of max changeset: 504:c3064f3cf1b7 user: me < me@mymail.com > date: Thu Feb 09 11:41:32 2012 -0800 files: CipherKey.cs description: removing ambiguous characters - CAC-47 

using hg log -r c3064f3cf1b7 , the following is hg log -r c3064f3cf1b7 (this is the default head):

 changeset: 504:c3064f3cf1b7 user: me < me@mymail.com > date: Thu Feb 09 11:41:32 2012 -0800 files: CipherKey.cs description: removing ambiguous characters - CAC-47 
+7
source share
2 answers

It just magically decided this, but it’s still not clear why. This seems to be a problem with default , although I am not working on this thread. I could name >hg branch and get the expected branch name.

I have changed the local default branch, which was not pressed, and did not want to. I rejected this change and then committed. Then I did a fetch in the default branch and merged it with my property branch. Then back to default . I merged with the default changeset, which I refused. At some point during this process, I got another head that probably caused multiple mergers.

It all seems to come down to the existing chapters by default, but I still don't know why (or why we would like) that affect a separate branch of names.

All this seems too complicated for what I expect (and what everyone can just extract in ascii diagrams)

Edit

It seems that the problem arose during the initial branch. It looks like I forked twice, and [j] is the default anonymous branch.

in order to visualize what seems to be happening, [j] is my set of changes I refused, and [k] is my first commit on mybranch:

 [a] -- [b] -- [c] -- [d] -- [e] (default) \ \ / [j]-----------\--- (not sure where this branch came from) \ \ [k] -- [l] -- [m] (mybranch. Still separate from default) 
+1
source

It is confusing that the --new-branch flag does not work when you click on function branches (also called anynomous branches). An anonymous branch is as follows:

 ... [a] --- [b] --- [c] <- the servers head on default \ [x] --- [y] <- my feature branch on default 

All change sets are on default , so now you have two heads on default . When you click, you will create two heads on the server, but Mercurial is interrupted before that with the warning you see. It is interrupted because several goals on the server are confusing: when you hg clone , your working copy will be updated to one of them, almost randomly.

The --new-branch flag is only for named branches . Mercurial is usually aborted if you push the new named branch to the remote repository. Adding the --new-branch flag is how you say it to go on.

Unfortunately, we do not have the --create-new-feature-branch flag selected. We only have the --force flag, which tells Mercurial to go ahead and create two chapters in the remote repository. The disadvantage of --force is that it overrides all security checks: you can click three or more new heads with this flag, and you can even click into an unrelated repository. Therefore, you should use hg outgoing to double check that you are going to click.

I wrote above that several heads on the server get confused, as the new clone will be updated to an arbitrary head. To avoid confusion, you can specify the branch names of objects by placing them in bookmarks. You will still be updated to an arbitrary head, but hg bookmarks will show you the available function branches, and you can update them to the desired one. Therefore, if you use such a workflow, go to hg push -f .

+14
source

All Articles