reflections about Mercurial
Matt Mackall
mpm at selenic.com
Thu Dec 26 22:57:29 UTC 2013
On Thu, 2013-12-26 at 21:42 +0100, JK wrote:
> Hi, I would like to share some terminological reflections of mine with
> other readers.
>
> At http://mercurial.selenic.com/wiki/Head we can read following definitions:
>
> * head -- a changeset that has no children
> * branch head -- a changeset in a branch that has no children in that
> branch
>
> OK, one has to take into account that the repository´s DAG can resemble
> a branch (or twig) only by chance. OK, never mind.
>
> According to this declarations, we can see two kinds of heads in the
> DAG: heads and branch heads. In a simplified way: heads == heads and
> branch heads, which is a little bit queer.
> It is a pity, we can´t say: heads == topological heads and branch heads,
> which is quite normal and corresponding to reality but not to the above
> mentioned definitions.
>
> Mercurial commands hg head and hg heads do the same action
In fact, they are the very same command, as is 'hg hea'.
> - return a
> list of heads, with the possibility to narrow the selection using the -t
> option.
It show branch heads.
$ hg help heads
hg heads [-ct] [-r STARTREV] [REV]...
show branch heads
The fact that this usually includes topological heads (which very few
people actually care about) is incidental.
> It is a pity, there does not exist the like option -b for branch heads.
> It could by used for listing of merge changesets.
If you wanted to show a set of changesets that were branch heads but not
topological heads, you could do this:
$ hg log -r 'head() and not heads(all())'
This is called a 'revset query' and we generally don't add new options
for the billions of things you can already do with such a query.
> There exists a little assymetry in viewing heads. Hg head returns all
> existing topological heads but only the last branch head for each branch
> - if there doesn´t exist the topological one.
False. It shows all non-closed branch heads without regard to whether
they're also topological heads.
> Another confusing term is "anonymous branch". Trying to learn Mercurial,
> we have to get know, that anonymous !== nameless but anonymous == with
> the name "default", which is unnecessarily counterintuitive.
Not sure where you got that idea. Strongly urge you to familiarize
yourself with the glossary, which unlike other sources such as the wiki
has actually gone through a review process:
$ hg help glossary
..
Branch, anonymous
Every time a new child changeset is created from a parent that is not
a head and the name of the branch is not changed, a new anonymous
branch is created.
An anonymous branch is simply any branch in the DAG that is not
distinguishable from other branches by name.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial
mailing list