tags:

views:

83

answers:

3

I'm trying to figure out why Mercurial thinks I'm trying to create a new remote branch in this situation:

alt text

Is it just trying to inform me that the branch will show up in the meta-data as a closed branch?

I'm on Mercurial v1.6.1023

Edit: the only branch on the remote repository is named "default"

A: 

EDIT: Misunderstood the question. The following is how you get multiple heads in one branch.


Normally a new head is created if you have a different base than the remote.
I've seen this in the following workflow:
R1 User A commits and pushes
R1 User B pulls
R2 User A commits and pushes
R? User B commits and pushes

Mercurial will decide that the push of User B is based on R1, while the server is on R2, so it will accept the changes of User B only on a different branch.
To prevent this, commit the changes of User B locally, then perform a hg pull, followed by a hg merge and merge your changes with the remote changes. Than you can push your changes to the remote server.

Ton
What you describe are different heads on one branch.
Rudi
A: 

Yes, even your closed branches are pushed when you do a hg push. If you want to push just default you can do a hg push -r default that then you won't see that message.

Ry4an
+1  A: 

By default hg push is going to push all changesets in your local repository that are not in the remote repository. If you have some changes on a local branch (Environment_Switching in your case) -- even a closed branch -- they'll go too unless you explicitly exclude them using hg push -b default (assuming you haven't merged that branch back onto default).

To answer your question, it's just a warning that you're creating a new remote branch.

EDIT: hg push -r default and hg push -b default are equivalent. From the output for hg help revs:

Mercurial supports several ways to specify individual revisions. ...text removed for brevity... A branch name denotes the tipmost revision of that branch.

Pushing the tipmost revision of a branch will also push its ancestors, which are the rest of the changesets on the branch.

Niall C.
Your explanation does clarify what the message is telling me. However, I did try "hg push -b default" and I still got the message that I was going to push new branch(es). I did not try @Ry4an's suggestion of "hg push -r default", but I'm guessing they are equivalent.
Steve Horn
It sounds like you merged the `Environment_Switching` branch back onto default already. In that case, you're either going to have to (a) push that branch to the remote repository (use the `--new-branch` option to `hg push`), or (b) use a combination of `hg clone`, `hg export` and `hg import` to create a local repository without the changes, then push from there, or (c) do some trickery with the Transplant extension to move the changes onto `default` before pushing.
Niall C.