Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revset.py @ 17171:9c750c3e4fac
obsolete: compute unstable changeset
An unstable changeset is a changeset *not* obsolete but with some obsolete
ancestors.
The current logic to decide if a changeset is unstable is naive and very
inefficient. A better solution is to compute the set of unstable changeset with
a simple revset and to cache the result. But this require cache invalidation
logic. Simpler version goes first.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Fri, 06 Jul 2012 00:18:09 +0200 |
parents | 63a4a3871607 |
children | c621f84dbb35 |
line wrap: on
line diff
--- a/mercurial/revset.py Fri Jul 06 19:29:10 2012 +0200 +++ b/mercurial/revset.py Fri Jul 06 00:18:09 2012 +0200 @@ -1317,6 +1317,14 @@ def tagged(repo, subset, x): return tag(repo, subset, x) +def unstable(repo, subset, x): + """``unstable()`` + Unstable changesets are non-obsolete with obsolete descendants.""" + getargs(x, 0, 0, _("obsolete takes no arguments")) + unstableset = set(repo.revs('(obsolete()::) - obsolete()')) + return [r for r in subset if r in unstableset] + + def user(repo, subset, x): """``user(string)`` User name contains string. The match is case-insensitive. @@ -1393,6 +1401,7 @@ "tag": tag, "tagged": tagged, "user": user, + "unstable": unstable, "_list": _list, }