comparison mercurial/scmutil.py @ 16171:336e61875335

graphlog: restore FILE glob expansion on Windows On platforms not supporting shell expansion, scmutil.match() performs glob expansion on 'pats' arguments. But _matchfiles() revset calls match.match() directly, bypassing this behaviour. To avoid duplicating scmutil.match(), a secondary scmutil.matchandpats() is introduced returning both the match object and the expanded inputs. Note the expanded pats are also needed in the fast path, and will be used by --follow code path.
author Patrick Mezard <patrick@mezard.eu>
date Sat, 25 Feb 2012 22:11:34 +0100
parents 94a8396c9305
children 85db991780b7
comparison
equal deleted inserted replaced
16170:ef2373ea3d24 16171:336e61875335
577 ret.extend(globbed) 577 ret.extend(globbed)
578 continue 578 continue
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':
586 pats = expandpats(pats or []) 586 pats = expandpats(pats or [])
587 587
588 m = ctx.match(pats, opts.get('include'), opts.get('exclude'), 588 m = ctx.match(pats, opts.get('include'), opts.get('exclude'),
589 default) 589 default)
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())
597 600
598 def matchfiles(repo, files): 601 def matchfiles(repo, files):