Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 11650:ebaf117c2642 stable
revset: fix ancestor subset handling (issue2298)
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 22 Jul 2010 08:17:38 -0500 |
parents | 6b836d5c8c9e |
children | ba65d61f3158 b75dea24e296 |
comparison
equal
deleted
inserted
replaced
11649:48163c39e1f1 | 11650:ebaf117c2642 |
---|---|
221 s = set(s) | 221 s = set(s) |
222 return [r for r in subset if r in s or repo[r].branch() in b] | 222 return [r for r in subset if r in s or repo[r].branch() in b] |
223 | 223 |
224 def ancestor(repo, subset, x): | 224 def ancestor(repo, subset, x): |
225 l = getargs(x, 2, 2, _("ancestor wants two arguments")) | 225 l = getargs(x, 2, 2, _("ancestor wants two arguments")) |
226 a = getset(repo, subset, l[0]) | 226 r = range(len(repo)) |
227 b = getset(repo, subset, l[1]) | 227 a = getset(repo, r, l[0]) |
228 if len(a) > 1 or len(b) > 1: | 228 b = getset(repo, r, l[1]) |
229 if len(a) != 1 or len(b) != 1: | |
229 raise error.ParseError(_("ancestor arguments must be single revisions")) | 230 raise error.ParseError(_("ancestor arguments must be single revisions")) |
230 return [repo[a[0]].ancestor(repo[b[0]]).rev()] | 231 an = [repo[a[0]].ancestor(repo[b[0]]).rev()] |
232 | |
233 return [r for r in an if r in subset] | |
231 | 234 |
232 def ancestors(repo, subset, x): | 235 def ancestors(repo, subset, x): |
233 args = getset(repo, range(len(repo)), x) | 236 args = getset(repo, range(len(repo)), x) |
234 if not args: | 237 if not args: |
235 return [] | 238 return [] |