Closed branch push behavior?

Matt Mackall mpm at selenic.com
Mon Dec 5 16:57:02 CST 2011


On Mon, 2011-12-05 at 16:52 -0500, Chuck.Kirschman at bentley.com wrote:
> Unfortunately for me, the user read the helpful message, pushed the
> branch to the server, which as you state makes it permanent.  It's
> been pulled by many, and trying to get the genie back into the bottle
> is nigh on impossible.  Is there any way to prevent it in the future? 

Here's the thing: the same problem potentially exists with tagging, but
people basically never have to say "how do we implement a system to keep
our idiotic users from tagging random releases?" because it's just
obvious that you shouldn't do that. And indeed, people using SVN or CVS
don't have this problem with branch naming either, even though they have
named branching that's conceptually identical to Mercurial. 

The problem is Git. Git "branches" are a completely different animal
from CVS/SVN/Mercurial branches in that they're completely ephemeral.
Mercurial actually has a close analog to Git branches called bookmarks,
but that won't help users who try to blindly apply Git practices without
reading 'hg help branch':

    Note:
       Branch names are permanent. Use "hg bookmark" to create a light-weight
       bookmark instead. See "hg help glossary" for more information about
       named branches and bookmarks.

I recommend communicating a policy for both branching and tagging and
that policy should be something like: "only Chuck Kirschman gets to add
tags or branches, but you may use bookmarks". You should no more
tolerate people sticking random branch names in the tree than you would
tolerate people tagging random release numbers, adding random files,
etc.

I might also consider something adding something like:

 $ hg branch foo
 marked working directory as branch foo
 warning: branches are permanent and global, did you want a bookmark?

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial mailing list