Mercurial > hg-stable
changeset 13932:34f577007ffe
revsets: preserve ordering with the or operator
This is valuable because now revsets like 'bookmarks() or tip' will
always show tip after bookmarks unless tip was itself a bookmark. This
is a somewhat contrived example, but this behavior is useful for
"where am I" type aliases that use log and revsets.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Wed, 13 Apr 2011 12:30:41 -0500 |
parents | c3372529247f |
children | 3d83c7d70a98 |
files | mercurial/revset.py tests/test-revset.t |
diffstat | 2 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revset.py Wed Apr 13 07:40:24 2011 +0530 +++ b/mercurial/revset.py Wed Apr 13 12:30:41 2011 -0500 @@ -156,9 +156,10 @@ return getset(repo, getset(repo, subset, x), y) def orset(repo, subset, x, y): - s = set(getset(repo, subset, x)) - s |= set(getset(repo, [r for r in subset if r not in s], y)) - return [r for r in subset if r in s] + xl = getset(repo, subset, x) + s = set(xl) + yl = getset(repo, [r for r in subset if r not in s], y) + return xl + yl def notset(repo, subset, x): s = set(getset(repo, subset, x))