[PATCH 0 of 9] improvements for named branches

Matt Mackall mpm at selenic.com
Sun Mar 2 16:17:40 CST 2008

On Sun, Mar 02, 2008 at 04:01:22PM -0300, Alexis S. L. Carvalho wrote:
> "Closing a branch" essentially means to remove it from the branch cache,
> which means that its name won't be recognized anymore, effectively
> hiding it.  I like "close" better than "remove" or "delete", since we're
> not actually removing anything from the repo itself.

How do you unclose a branch? For example, if some bonehead closes
stable using merge --close? Merge --close is a bit worrisome and so is
the non-locality of the closures is as well. How do I find commits
where the close happened so I know who the bonehead is?

Also, what happens if you do:

hg branch --close thisbranch
hg add newfile
hg ci

Also, how do you unclose a branch before commit?

I'd rather require an explicit commit on the branch head(s) to move it
to the "inactive" state. Then a "closed" branch is one where all its
heads are inactive. I think this should look something like:

$ hg branch
$ hg commit --close-branch 
abort: there are outstanding changes
$ hg revert -aq
$ hg commit --close-branch -m "foo is dead"
$ hg branch
$ hg add newfile
$ hg commit -m "foo is risen"

(We'll have to check that our parent's branch is also foo, otherwise,
we're doing a no-op: opening and closing a branch head simultaneously.)

Moving closing to commit simplifies things a bit - we don't have to do
any special storage of the "close" intent, we don't need a way to
display or erase that intent, and we don't have to check all our other
actions against that intent.

This is different than starting a branch, where it makes sense to
actually change a few things before committing (like version
identifiers). Also, we encourage people to explain why they close
branches by making it the sole contents of the commit (and not having
a default message).

Finally, I presume you intend it to be possible to find closed
branches with the branches command? What happens if you attempt to
merge with a branch that has one open head and one closed head? I
really don't like that you've made branch names ambiguous. Tags are
not ambiguous, 'tip' is not ambiguous, and I don't think branch names
should be either. There should instead be a precedence ordering. If I
say "merge with foo", the open branch head closest to tip is what I
should get. If there is none, I should get the closed branch head
closest to tip.

(I may not be able to actually look at this stuff in depth for a
couple days - my laptop is just barely limping along and I'm reading
this with no backlight while waiting for a new laptop to arrive.)

Mathematics is the supreme nostalgia of our time.

More information about the Mercurial-devel mailing list