mercurial/cmdutil.py
changeset 3528 39011927fdb0
parent 3526 68341c06bc61
child 3531 730ca93ed788
equal deleted inserted replaced
3527:45620faafa28 3528:39011927fdb0
   136                            for x in opts.get('exclude', [])]
   136                            for x in opts.get('exclude', [])]
   137         cwd = ''
   137         cwd = ''
   138     return util.cmdmatcher(repo.root, cwd, pats or ['.'], opts.get('include'),
   138     return util.cmdmatcher(repo.root, cwd, pats or ['.'], opts.get('include'),
   139                            opts.get('exclude'), head)
   139                            opts.get('exclude'), head)
   140 
   140 
   141 def makewalk(repo, pats=[], opts={}, node=None, head='', badmatch=None):
   141 def walk(repo, pats=[], opts={}, node=None, head='', badmatch=None):
   142     files, matchfn, anypats = matchpats(repo, pats, opts, head)
   142     files, matchfn, anypats = matchpats(repo, pats, opts, head)
   143     exact = dict(zip(files, files))
   143     exact = dict(zip(files, files))
   144     def walk():
   144     for src, fn in repo.walk(node=node, files=files, match=matchfn,
   145         for src, fn in repo.walk(node=node, files=files, match=matchfn,
   145                              badmatch=badmatch):
   146                                  badmatch=badmatch):
   146         yield src, fn, util.pathto(repo.getcwd(), fn), fn in exact
   147             yield src, fn, util.pathto(repo.getcwd(), fn), fn in exact
       
   148     return files, matchfn, walk()
       
   149 
       
   150 def walk(repo, pats=[], opts={}, node=None, head='', badmatch=None):
       
   151     files, matchfn, results = makewalk(repo, pats, opts, node, head, badmatch)
       
   152     for r in results:
       
   153         yield r
       
   154 
   147 
   155 def findrenames(repo, added=None, removed=None, threshold=0.5):
   148 def findrenames(repo, added=None, removed=None, threshold=0.5):
   156     if added is None or removed is None:
   149     if added is None or removed is None:
   157         added, removed = repo.status()[1:3]
   150         added, removed = repo.status()[1:3]
   158     changes = repo.changelog.read(repo.dirstate.parents()[0])
   151     changes = repo.changelog.read(repo.dirstate.parents()[0])