Mercurial > public > mercurial-scm > hg
comparison mercurial/scmutil.py @ 25928:4ee4f7415095
revrange: evaluate all revset specs at once
This provides an opportunity for revset to optimize given expressions. For
example, "-r0 -r1 -r2" can be optimized to "_list(0 1 2)".
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 05 Jul 2015 12:35:42 +0900 |
parents | fbaa2de13cf6 |
children | cc3a30ff9490 |
comparison
equal
deleted
inserted
replaced
25927:44da63623fca | 25928:4ee4f7415095 |
---|---|
718 | 718 |
719 _revrangesep = ':' | 719 _revrangesep = ':' |
720 | 720 |
721 def revrange(repo, revs): | 721 def revrange(repo, revs): |
722 """Yield revision as strings from a list of revision specifications.""" | 722 """Yield revision as strings from a list of revision specifications.""" |
723 subsets = [] | 723 allspecs = [] |
724 for spec in revs: | 724 for spec in revs: |
725 if isinstance(spec, int): | 725 if isinstance(spec, int): |
726 spec = revset.formatspec('rev(%d)', spec) | 726 spec = revset.formatspec('rev(%d)', spec) |
727 m = revset.match(repo.ui, spec, repo) | 727 allspecs.append(spec) |
728 subsets.append(m(repo)) | 728 m = revset.matchany(repo.ui, allspecs, repo) |
729 | 729 return m(repo) |
730 return revset._combinesets(subsets) | |
731 | 730 |
732 def expandpats(pats): | 731 def expandpats(pats): |
733 '''Expand bare globs when running on windows. | 732 '''Expand bare globs when running on windows. |
734 On posix we assume it already has already been done by sh.''' | 733 On posix we assume it already has already been done by sh.''' |
735 if not util.expandglobs: | 734 if not util.expandglobs: |