Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Mercurial revsets and phases are two killer features of mercurial that blows any counterpart git has out of the water.

Phases are a property of revisions that essentially let you know their state. By default, there are three phases: public, draft, and secret. You can't rebase a public revision, nor can you have a public revision with a secret parent. So you get out of this concept things like safe rebasing, or barriers that let you keep internal and external repos separate.

But revsets really shine. This is basically a full-on query language for revisions. So you can define a query alias "wip" that specifies all of the, well, interesting revisions: every revision that is not in the public phase (i.e., not in the upstream repo), the tip of the trunk, the current revision, and sufficient ancestor information of these revisions that you can see where you based all of these WIP branches on. In a single query: "(parents(not public()) or not public() or . or head())".

Sure, composing revsets is definitely a somewhat painful process... but it's possible to describe more or less arbitrary sets with a Mercurial revset, and I've never been able to find a similar workable setup in git.



Why do you want to? Not trying to be snarky, but I've been using various source control tools for closer to 20 years than 10 and I can't remember when I've ever needed or would have benefited from revsets. I'm genuinely curious what problem this solves and whether I've just never experienced or have made my own hodge podge solution for it incidentally.


I am used to working in large repos (>100 commits/day), which generally means that something like 'git log --graph' contains a lot of extraneous information.

The most common workflow I have is that I've got a couple of old working branches (like featurea and featureb), and I want to see if I need to update featureb to a newer head or not, or if featureb was based on featurea or featurea-v2. A demonstration of this kind of thing is 'hg wip' here: http://jordi.inversethought.com/blog/customising-mercurial-l....

Another thing I would use revsets for is answering queries like "which of these changes that's on the public repository made its way into the internal repository (which periodically merges from the public repo)?"


No disrespect but you’re kidding, right?

We often (a.k.a. constantly) want to see a subset of commits that meet some criteria.

The way Git handles this is by adding more flags, which doesn’t scale.

Just look at the man page for git log… it’s nuts.

Having a concise functional query language [1] is one of Mercurial’s and I guess Sapling’s killer features.

[1]: https://hg.mozilla.org/mozilla-central/help/revsets




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: