push aborts for new branch even if no heads

Henrik Stuart hg at hstuart.dk
Thu Nov 12 13:04:48 CST 2009


Luke Opperman wrote:
> Hi -
> 
> Using mercurial 1.3.1 and recent mercurial-crew.
> 
> The scenario: trying to push changes that include the creation & subsequent
> merging of a branch - the branch has no heads, but push still requires the use
> of --force.
> 
> Unexpected to me, and especially as the error suggests merging when there is
> nothing left to merge. Particularly annoying for downstream forks, as each fork
> to be updated with upstream changes will need to use --force when they get this
> set of changes. Is there an issue with creating remote headless branches that
> I'm missing here, or is this just a bug?

When pushing, the existence of new remote heads is determined on a named
branch basis, so you are, in effect, creating a new remote head for the
branch t (even if it is merged into another branch it is still a branch
head), thus you'll require --force.

We submitted a patch a while ago to split this behaviour into two:
--force when one is creating multiple new heads, and --new-branch when
one is pushing a new branch. The patch never really went anywhere, so
perhaps I'll try to give it another pitch as this seems to be a frequent
point of confusion for people.

-- 
Kind regards,
  Henrik Stuart


More information about the Mercurial-devel mailing list