Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revset.py @ 20527:bde426f18e0a
revset: changed mfunc and getset to work with old style revset methods
Now extensions shouldn't break when adding new revsets.
author | Lucas Moscovicz <lmoscovicz@fb.com> |
---|---|
date | Tue, 18 Feb 2014 15:54:46 -0800 |
parents | 9ad6dae67845 |
children | 4849f574aa24 |
comparison
equal
deleted
inserted
replaced
20526:9ad6dae67845 | 20527:bde426f18e0a |
---|---|
193 return l | 193 return l |
194 | 194 |
195 def getset(repo, subset, x): | 195 def getset(repo, subset, x): |
196 if not x: | 196 if not x: |
197 raise error.ParseError(_("missing argument")) | 197 raise error.ParseError(_("missing argument")) |
198 return methods[x[0]](repo, subset, *x[1:]) | 198 s = methods[x[0]](repo, subset, *x[1:]) |
199 if util.safehasattr(s, 'set'): | |
200 return s | |
201 return baseset(s) | |
199 | 202 |
200 def _getrevsource(repo, r): | 203 def _getrevsource(repo, r): |
201 extra = repo[r].extra() | 204 extra = repo[r].extra() |
202 for label in ('source', 'transplant_source', 'rebase_source'): | 205 for label in ('source', 'transplant_source', 'rebase_source'): |
203 if label in extra: | 206 if label in extra: |
1947 raise error.ParseError(_("invalid token"), pos) | 1950 raise error.ParseError(_("invalid token"), pos) |
1948 if ui: | 1951 if ui: |
1949 tree = findaliases(ui, tree) | 1952 tree = findaliases(ui, tree) |
1950 weight, tree = optimize(tree, True) | 1953 weight, tree = optimize(tree, True) |
1951 def mfunc(repo, subset): | 1954 def mfunc(repo, subset): |
1952 return getset(repo, subset, tree) | 1955 if util.safehasattr(subset, 'set'): |
1956 return getset(repo, subset, tree) | |
1957 return getset(repo, baseset(subset), tree) | |
1953 return mfunc | 1958 return mfunc |
1954 | 1959 |
1955 def formatspec(expr, *args): | 1960 def formatspec(expr, *args): |
1956 ''' | 1961 ''' |
1957 This is a convenience function for using revsets internally, and | 1962 This is a convenience function for using revsets internally, and |