Show More
@@ -17,8 +17,7 b' from mercurial.commands import templateo' | |||||
17 | from mercurial.i18n import _ |
|
17 | from mercurial.i18n import _ | |
18 | from mercurial.node import nullrev |
|
18 | from mercurial.node import nullrev | |
19 | from mercurial import cmdutil, commands, extensions, scmutil |
|
19 | from mercurial import cmdutil, commands, extensions, scmutil | |
20 | from mercurial import hg, util, graphmod, templatekw |
|
20 | from mercurial import hg, util, graphmod, templatekw, revset | |
21 | from mercurial import revset as revsetmod |
|
|||
22 |
|
21 | |||
23 | cmdtable = {} |
|
22 | cmdtable = {} | |
24 | command = cmdutil.command(cmdtable) |
|
23 | command = cmdutil.command(cmdtable) | |
@@ -243,7 +242,7 b' def check_unsupported_flags(pats, opts):' | |||||
243 | raise util.Abort(_("-G/--graph option is incompatible with --%s") |
|
242 | raise util.Abort(_("-G/--graph option is incompatible with --%s") | |
244 | % op.replace("_", "-")) |
|
243 | % op.replace("_", "-")) | |
245 |
|
244 | |||
246 | def makefilematcher(repo, pats, followfirst): |
|
245 | def _makefilematcher(repo, pats, followfirst): | |
247 | # When displaying a revision with --patch --follow FILE, we have |
|
246 | # When displaying a revision with --patch --follow FILE, we have | |
248 | # to know which file of the revision must be diffed. With |
|
247 | # to know which file of the revision must be diffed. With | |
249 | # --follow, we want the names of the ancestors of FILE in the |
|
248 | # --follow, we want the names of the ancestors of FILE in the | |
@@ -373,11 +372,11 b' def _makelogrevset(repo, pats, opts, rev' | |||||
373 | filematcher = None |
|
372 | filematcher = None | |
374 | if opts.get('patch') or opts.get('stat'): |
|
373 | if opts.get('patch') or opts.get('stat'): | |
375 | if follow: |
|
374 | if follow: | |
376 | filematcher = makefilematcher(repo, pats, followfirst) |
|
375 | filematcher = _makefilematcher(repo, pats, followfirst) | |
377 | else: |
|
376 | else: | |
378 | filematcher = lambda rev: match |
|
377 | filematcher = lambda rev: match | |
379 |
|
378 | |||
380 |
|
|
379 | expr = [] | |
381 | for op, val in opts.iteritems(): |
|
380 | for op, val in opts.iteritems(): | |
382 | if not val: |
|
381 | if not val: | |
383 | continue |
|
382 | continue | |
@@ -385,19 +384,19 b' def _makelogrevset(repo, pats, opts, rev' | |||||
385 | continue |
|
384 | continue | |
386 | revop, andor = opt2revset[op] |
|
385 | revop, andor = opt2revset[op] | |
387 | if '%(val)' not in revop: |
|
386 | if '%(val)' not in revop: | |
388 |
|
|
387 | expr.append(revop) | |
389 | else: |
|
388 | else: | |
390 | if not isinstance(val, list): |
|
389 | if not isinstance(val, list): | |
391 |
e |
|
390 | e = revop % {'val': val} | |
392 | else: |
|
391 | else: | |
393 |
e |
|
392 | e = '(' + andor.join((revop % {'val': v}) for v in val) + ')' | |
394 |
|
|
393 | expr.append(e) | |
395 |
|
394 | |||
396 |
if |
|
395 | if expr: | |
397 |
|
|
396 | expr = '(' + ' and '.join(expr) + ')' | |
398 | else: |
|
397 | else: | |
399 |
|
|
398 | expr = None | |
400 |
return |
|
399 | return expr, filematcher | |
401 |
|
400 | |||
402 | def getlogrevs(repo, pats, opts): |
|
401 | def getlogrevs(repo, pats, opts): | |
403 | """Return (revs, expr, filematcher) where revs is a list of |
|
402 | """Return (revs, expr, filematcher) where revs is a list of | |
@@ -426,7 +425,7 b' def getlogrevs(repo, pats, opts):' | |||||
426 | # Evaluate revisions in changelog order for performance |
|
425 | # Evaluate revisions in changelog order for performance | |
427 | # reasons but preserve the original sequence order in the |
|
426 | # reasons but preserve the original sequence order in the | |
428 | # filtered result. |
|
427 | # filtered result. | |
429 |
matched = set(revset |
|
428 | matched = set(revset.match(repo.ui, expr)(repo, sorted(revs))) | |
430 | revs = [r for r in revs if r in matched] |
|
429 | revs = [r for r in revs if r in matched] | |
431 | return revs, expr, filematcher |
|
430 | return revs, expr, filematcher | |
432 |
|
431 |
General Comments 0
You need to be logged in to leave comments.
Login now