Closed branch push behavior?

Matt Mackall mpm at selenic.com
Tue Dec 6 22:30:36 UTC 2011


On Tue, 2011-12-06 at 22:59 +0100, Martin Geisler wrote:
> Angel Ezquerra <angel.ezquerra at gmail.com> writes:
> 
> > El 06/12/2011 18:41, "Matt Mackall" <mpm at selenic.com> escribió:
> >> >
> >> > 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?
> >>
> >> Sure, but that's not what push cares about here. Push cares about
> >> whether or not the history should be transmitted. If, for instance,
> >> you're Chuck's coworker, the answer here is a big fat "no": you
> >> shouldn't have created the branch in the first place and now this
> >> warning is your last chance to avoid publishing it.
> 
> Right, it's the last chance before publication. But since we have an
> append-only history in Mercurial, wouldn't it make more sense to let him
> fix the mistake by closing the branch again?

Uh, what? Weren't we already talking about pushing a closed branch? What
does "closing a branch again" even mean? My point is closed vs open is
irrelevant: the issue here is all about publishing or not publishing. A
published "closed" branch is _still public_. 

> Now we require him to "somehow" (using mq, transplant, or other advanced
> commands) to redo the commits.

We don't "require" anything of the sort. But you do have to make a
choice: do you want to push this previously-not-public branch with
--new-branch or do you want to do.. something else. The right answer
might be "oh, I'm a dumbass, I'm trying to push the proprietary branch
to the public repo".

> Fixing the mistake by closing the branch is much more in line with how
> we recommend fixing other mistakes with 'hg backout'.
> 
> Here's a quick idea: could we let
> 
>   hg branch --rename default
> 
> add a changeset that
> 
> 1) closes the current branch
> 
> 2) makes "default" the current branch
> 
> 3) says "please treat the ancestor changesets as if they were on the
>    default branch" too

Yuck.

-- 
Mathematics is the supreme nostalgia of our time.





More information about the Mercurial mailing list