Closed branch push behavior?

Angel Ezquerra angel.ezquerra at gmail.com
Tue Dec 6 04:38:58 CST 2011


On Dec 5, 2011 10:48 PM, "Matt Mackall" <mpm at selenic.com> wrote:
>
> On Mon, 2011-12-05 at 16:09 -0500, Chuck.Kirschman at bentley.com wrote:
> > I tried to push some changes from one repo to another and it
> > complained that it would create new branches, even though the branch
> > in question is closed.  Is that the expected behavior?  "Hg branches"
> > doesn't show it, so it is pretty confusing to figure it out, and it
> > isn't creating an open branch.  I'm using 1.9.3.
> >
> > [D:\foo]hg --debug push
> > pushing to http://foo.bar.com/foo
> > searching for changes
> > abort: push creates new remote branches: wip_unicode!
> > (use 'hg push --new-branch' to create new remote branches)
> >
> > [D:\foo]hg branches
> > default                     3187:fa2769398873
> >
> > [D:\foo]hg branches -c
> > default                     3187:fa2769398873
> > wip_unicode                 3108:2426340ca7ae (closed)
>
> I think this is the intended behavior. The message:
>
>  abort: push creates new remote branches: wip_unicode!
>
> ..is correct in that a branch that only exists locally will be pushed to
> the remote server. Since Mercurial's branches become permanent
> components of history, this serves to make sure you don't inadvertently
> publish permanent history that you don't intend to. Whether or not it's
> "closed", it's still published by push. So you should either simply use
> --new-branch as hinted, or destroy the unwanted branch locally and not
> do that again.

Matt,

I have a related question that hopefully you can also address.

I wonder whether it makes sense for mercurial to complain that you'll
create a new head when you close a branch and push the resulting new head.

Technically mercurial is right in that you are indeed pushing a new head,
but isn't it obvious that this new head is not meant to be developed
further?

Actually, I believe that mercurial will happily let you commit on top of a
"close branch commit", which would be weird (I can't test this from my
phone). You should have to use the --force option for that...

Cheers,

Angel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial/attachments/20111206/5916d467/attachment.html>


More information about the Mercurial mailing list