Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 2884:fcdcf0c19998
add default values to arguments of walk etc.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Sun, 13 Aug 2006 17:03:03 -0700 |
parents | c2932ad5476a |
children | bd29a3067b97 |
comparison
equal
deleted
inserted
replaced
2883:c2932ad5476a | 2884:fcdcf0c19998 |
---|---|
75 opts['exclude'] = [os.path.join(cwd, x) for x in opts['exclude']] | 75 opts['exclude'] = [os.path.join(cwd, x) for x in opts['exclude']] |
76 cwd = '' | 76 cwd = '' |
77 return util.cmdmatcher(repo.root, cwd, pats or ['.'], opts.get('include'), | 77 return util.cmdmatcher(repo.root, cwd, pats or ['.'], opts.get('include'), |
78 opts.get('exclude'), head) | 78 opts.get('exclude'), head) |
79 | 79 |
80 def makewalk(repo, pats, opts, node=None, head='', badmatch=None): | 80 def makewalk(repo, pats=[], opts={}, node=None, head='', badmatch=None): |
81 files, matchfn, anypats = matchpats(repo, pats, opts, head) | 81 files, matchfn, anypats = matchpats(repo, pats, opts, head) |
82 exact = dict(zip(files, files)) | 82 exact = dict(zip(files, files)) |
83 def walk(): | 83 def walk(): |
84 for src, fn in repo.walk(node=node, files=files, match=matchfn, | 84 for src, fn in repo.walk(node=node, files=files, match=matchfn, |
85 badmatch=badmatch): | 85 badmatch=badmatch): |
86 yield src, fn, util.pathto(repo.getcwd(), fn), fn in exact | 86 yield src, fn, util.pathto(repo.getcwd(), fn), fn in exact |
87 return files, matchfn, walk() | 87 return files, matchfn, walk() |
88 | 88 |
89 def walk(repo, pats, opts, node=None, head='', badmatch=None): | 89 def walk(repo, pats=[], opts={}, node=None, head='', badmatch=None): |
90 files, matchfn, results = makewalk(repo, pats, opts, node, head, badmatch) | 90 files, matchfn, results = makewalk(repo, pats, opts, node, head, badmatch) |
91 for r in results: | 91 for r in results: |
92 yield r | 92 yield r |
93 | 93 |
94 def addremove(repo, pats, opts={}, wlock=None, dry_run=None): | 94 def addremove(repo, pats=[], opts={}, wlock=None, dry_run=None): |
95 if dry_run is None: | 95 if dry_run is None: |
96 dry_run = opts.get('dry_run') | 96 dry_run = opts.get('dry_run') |
97 add, remove = [], [] | 97 add, remove = [], [] |
98 for src, abs, rel, exact in walk(repo, pats, opts): | 98 for src, abs, rel, exact in walk(repo, pats, opts): |
99 if src == 'f' and repo.dirstate.state(abs) == '?': | 99 if src == 'f' and repo.dirstate.state(abs) == '?': |