2187 if expr: |
2187 if expr: |
2188 # Revset matchers often operate faster on revisions in changelog |
2188 # Revset matchers often operate faster on revisions in changelog |
2189 # order, because most filters deal with the changelog. |
2189 # order, because most filters deal with the changelog. |
2190 if not opts.get('rev'): |
2190 if not opts.get('rev'): |
2191 revs.reverse() |
2191 revs.reverse() |
2192 matcher = revset.match(repo.ui, expr) |
2192 matcher = revset.match(repo.ui, expr, order=revset.followorder) |
2193 # Revset matches can reorder revisions. "A or B" typically returns |
|
2194 # returns the revision matching A then the revision matching B. Sort |
|
2195 # again to fix that. |
|
2196 fixopts = ['branch', 'only_branch', 'keyword', 'user'] |
|
2197 oldrevs = revs |
|
2198 revs = matcher(repo, revs) |
2193 revs = matcher(repo, revs) |
2199 if not opts.get('rev'): |
2194 if not opts.get('rev'): |
2200 revs.sort(reverse=True) |
2195 revs.reverse() |
2201 elif len(pats) > 1 or any(len(opts.get(op, [])) > 1 for op in fixopts): |
|
2202 # XXX "A or B" is known to change the order; fix it by filtering |
|
2203 # matched set again (issue5100) |
|
2204 revs = oldrevs & revs |
|
2205 if limit is not None: |
2196 if limit is not None: |
2206 limitedrevs = [] |
2197 limitedrevs = [] |
2207 for idx, r in enumerate(revs): |
2198 for idx, r in enumerate(revs): |
2208 if limit <= idx: |
2199 if limit <= idx: |
2209 break |
2200 break |