comparison mercurial/revset.py @ 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 8f81d6f4047f
children e44ebd2a142a
comparison
equal deleted inserted replaced
13931:c3372529247f 13932:34f577007ffe
154 154
155 def andset(repo, subset, x, y): 155 def andset(repo, subset, x, y):
156 return getset(repo, getset(repo, subset, x), y) 156 return getset(repo, getset(repo, subset, x), y)
157 157
158 def orset(repo, subset, x, y): 158 def orset(repo, subset, x, y):
159 s = set(getset(repo, subset, x)) 159 xl = getset(repo, subset, x)
160 s |= set(getset(repo, [r for r in subset if r not in s], y)) 160 s = set(xl)
161 return [r for r in subset if r in s] 161 yl = getset(repo, [r for r in subset if r not in s], y)
162 return xl + yl
162 163
163 def notset(repo, subset, x): 164 def notset(repo, subset, x):
164 s = set(getset(repo, subset, x)) 165 s = set(getset(repo, subset, x))
165 return [r for r in subset if r not in s] 166 return [r for r in subset if r not in s]
166 167