plong
plong

Reputation: 1753

Can't push branch to remote Hg repo

I spent yesterday searching via Google and looking through SO for an answer but couldn't find anyone having the exact problem I'm having.

A while ago, I created a branch at Rev 176 in my local Mercurial repo and at Rev 196 created the named branch, "Port to VS2010." See the TortoiseHg screen cap below. I've been able to successfully push the other, "006-x86 and x64 Builds" branch to the remote repo but whenever I try to push the new branch, I get this error in the log:

abort: push creates new remote head 207852dab969!
hint: merge or see "hg help push" for details about pushing new heads

Short of merging or forcing it, how can I push this branch? It represents a tentative solution that will probably never be needed, but I wanted to keep it around just in case.

(Note: You'll notice three gaps in the Rev column. They represent immaterial changsets for the "006-x86 and x64 Builds" branch. I removed them in order to shorten the image.)

enter image description here

Update: Per Lazy Badger:

acs_FromBuildServer_edited% hg heads -T "{node|short} {branch}\n"
% hg heads -T "{node|short} {branch}\n"
24af28a99211 006-x86 and x64 Builds
69be2af28b7c Port to VS2010
207852dab969 default
86e00db4ba95 005-No Register CardContext
9df44947cc8b 004-Hack typedef boost shared_ptr
81055bcdb3cc 003-Use boost shared_ptr
6358126f4757 002-Add Meyers Fix
1e23ed012883 001-Solution
bcc01f6fbef4 default
[command completed successfully Fri Feb 12 11:15:36 2016]
acs_FromBuildServer_edited% 

Upvotes: 0

Views: 3841

Answers (2)

Lazy Badger
Lazy Badger

Reputation: 97282

It seems you have possible mix of two unrelated problems

  • anonymous branching (2 heads of some branch)
  • pushing new (not existing on remote) branch

New (named) branch have to be pushed with added option to default push command (--new-branch in CLI) or "Allow push to new branch" checkbox in THG GUI

Interface

Options

Pushing additional head in bad idea in common, better to find this new head in pre-existing branch and merge

Well, as expected, you have two heads of default branch

207852dab969 default
...
bcc01f6fbef4 default

and according to error message head 207852dab969 (r195) is new, not pushed yet. No, closing branch will not allow you to push branch. If you don't want to merge or force push, you can move diverged history (from branchpoint) to another named branch

Upvotes: 1

Stephen Rasku
Stephen Rasku

Reputation: 2682

Actually, you only have two choices. You can merge or you can force it. I think in your case you want to force it.

Typically, you don't want to force a new head because other developers might not be aware of the new head. Since this is an experiment you just want to keep for posterity then it's fine to force it. If you find out you need it you would merge it at that time.

Upvotes: 2

Related Questions