Show More
@@ -268,7 +268,11 b' def revset(repo, pats, opts):' | |||||
268 | if 'branch' in opts and 'only_branch' in opts: |
|
268 | if 'branch' in opts and 'only_branch' in opts: | |
269 | opts['branch'] = opts['branch'] + opts.pop('only_branch') |
|
269 | opts['branch'] = opts['branch'] + opts.pop('only_branch') | |
270 |
|
270 | |||
271 | match = scmutil.match(repo[None], pats, opts) |
|
271 | # pats/include/exclude are passed to match.match() directly in | |
|
272 | # _matchfile() revset but walkchangerevs() builds its matcher with | |||
|
273 | # scmutil.match(). The difference is input pats are globbed on | |||
|
274 | # platforms without shell expansion (windows). | |||
|
275 | match, pats = scmutil.matchandpats(repo[None], pats, opts) | |||
272 | slowpath = match.anypats() or (match.files() and opts.get('removed')) |
|
276 | slowpath = match.anypats() or (match.files() and opts.get('removed')) | |
273 | if not slowpath: |
|
277 | if not slowpath: | |
274 | for f in match.files(): |
|
278 | for f in match.files(): |
@@ -579,7 +579,7 b' def expandpats(pats):' | |||||
579 | ret.append(p) |
|
579 | ret.append(p) | |
580 | return ret |
|
580 | return ret | |
581 |
|
581 | |||
582 | def match(ctx, pats=[], opts={}, globbed=False, default='relpath'): |
|
582 | def matchandpats(ctx, pats=[], opts={}, globbed=False, default='relpath'): | |
583 | if pats == ("",): |
|
583 | if pats == ("",): | |
584 | pats = [] |
|
584 | pats = [] | |
585 | if not globbed and default == 'relpath': |
|
585 | if not globbed and default == 'relpath': | |
@@ -590,7 +590,10 b' def match(ctx, pats=[], opts={}, globbed' | |||||
590 | def badfn(f, msg): |
|
590 | def badfn(f, msg): | |
591 | ctx._repo.ui.warn("%s: %s\n" % (m.rel(f), msg)) |
|
591 | ctx._repo.ui.warn("%s: %s\n" % (m.rel(f), msg)) | |
592 | m.bad = badfn |
|
592 | m.bad = badfn | |
593 | return m |
|
593 | return m, pats | |
|
594 | ||||
|
595 | def match(ctx, pats=[], opts={}, globbed=False, default='relpath'): | |||
|
596 | return matchandpats(ctx, pats, opts, globbed, default)[0] | |||
594 |
|
597 | |||
595 | def matchall(repo): |
|
598 | def matchall(repo): | |
596 | return matchmod.always(repo.root, repo.getcwd()) |
|
599 | return matchmod.always(repo.root, repo.getcwd()) |
@@ -1510,8 +1510,10 b' Dedicated repo for --follow and paths fi' | |||||
1510 | $ hg init follow |
|
1510 | $ hg init follow | |
1511 | $ cd follow |
|
1511 | $ cd follow | |
1512 | $ echo a > a |
|
1512 | $ echo a > a | |
|
1513 | $ echo aa > aa | |||
1513 | $ hg ci -Am "add a" |
|
1514 | $ hg ci -Am "add a" | |
1514 | adding a |
|
1515 | adding a | |
|
1516 | adding aa | |||
1515 | $ hg cp a b |
|
1517 | $ hg cp a b | |
1516 | $ hg ci -m "copy a b" |
|
1518 | $ hg ci -m "copy a b" | |
1517 | $ mkdir dir |
|
1519 | $ mkdir dir | |
@@ -1549,3 +1551,14 b' Test multiple --include/--exclude/paths' | |||||
1549 |
|
1551 | |||
1550 | $ testlog --include a --include e --exclude b --exclude e a e |
|
1552 | $ testlog --include a --include e --exclude b --exclude e a e | |
1551 | ('group', ('group', ('func', ('symbol', '_matchfiles'), ('list', ('list', ('list', ('list', ('list', ('string', 'p:a'), ('string', 'p:e')), ('string', 'i:a')), ('string', 'i:e')), ('string', 'x:b')), ('string', 'x:e'))))) |
|
1553 | ('group', ('group', ('func', ('symbol', '_matchfiles'), ('list', ('list', ('list', ('list', ('list', ('string', 'p:a'), ('string', 'p:e')), ('string', 'i:a')), ('string', 'i:e')), ('string', 'x:b')), ('string', 'x:e'))))) | |
|
1554 | ||||
|
1555 | Test glob expansion of pats | |||
|
1556 | ||||
|
1557 | $ expandglobs=`python -c "import mercurial.util; \ | |||
|
1558 | > print mercurial.util.expandglobs and 'true' or 'false'"` | |||
|
1559 | $ if [ $expandglobs = "true" ]; then | |||
|
1560 | > testlog 'a*'; | |||
|
1561 | > else | |||
|
1562 | > testlog a*; | |||
|
1563 | > fi; | |||
|
1564 | ('group', ('group', ('func', ('symbol', 'filelog'), ('string', 'aa')))) |
General Comments 0
You need to be logged in to leave comments.
Login now