##// END OF EJS Templates
walk: remove cmdutil.walk
Matt Mackall -
r6585:d3d1d39d default
parent child Browse files
Show More
@@ -235,10 +235,6 b' def match(repo, pats=[], opts={}, globbe'
235 m.bad = badfn
235 m.bad = badfn
236 return m
236 return m
237
237
238 def walk(repo, match, node=None):
239 for src, fn in repo.walk(node, match):
240 yield src, fn
241
242 def findrenames(repo, added=None, removed=None, threshold=0.5):
238 def findrenames(repo, added=None, removed=None, threshold=0.5):
243 '''find renamed files -- yields (before, after, score) tuples'''
239 '''find renamed files -- yields (before, after, score) tuples'''
244 if added is None or removed is None:
240 if added is None or removed is None:
@@ -275,7 +271,7 b' def addremove(repo, pats=[], opts={}, dr'
275 add, remove = [], []
271 add, remove = [], []
276 mapping = {}
272 mapping = {}
277 m = match(repo, pats, opts)
273 m = match(repo, pats, opts)
278 for src, abs in walk(repo, m):
274 for src, abs in repo.walk(m):
279 target = repo.wjoin(abs)
275 target = repo.wjoin(abs)
280 rel = m.rel(abs)
276 rel = m.rel(abs)
281 exact = m.exact(abs)
277 exact = m.exact(abs)
@@ -317,7 +313,7 b' def copy(ui, repo, pats, opts, rename=Fa'
317 def walkpat(pat):
313 def walkpat(pat):
318 srcs = []
314 srcs = []
319 m = match(repo, [pat], opts, globbed=True)
315 m = match(repo, [pat], opts, globbed=True)
320 for tag, abs in walk(repo, m):
316 for tag, abs in repo.walk(m):
321 state = repo.dirstate[abs]
317 state = repo.dirstate[abs]
322 rel = m.rel(abs)
318 rel = m.rel(abs)
323 exact = m.exact(abs)
319 exact = m.exact(abs)
@@ -33,7 +33,7 b' def add(ui, repo, *pats, **opts):'
33 names = []
33 names = []
34 m = cmdutil.match(repo, pats, opts)
34 m = cmdutil.match(repo, pats, opts)
35 m.bad = lambda x,y: True
35 m.bad = lambda x,y: True
36 for src, abs in cmdutil.walk(repo, m):
36 for src, abs in repo.walk(m):
37 if m.exact(abs):
37 if m.exact(abs):
38 if ui.verbose:
38 if ui.verbose:
39 ui.status(_('adding %s\n') % m.rel(abs))
39 ui.status(_('adding %s\n') % m.rel(abs))
@@ -110,7 +110,7 b' def annotate(ui, repo, *pats, **opts):'
110 ctx = repo.changectx(opts['rev'])
110 ctx = repo.changectx(opts['rev'])
111
111
112 m = cmdutil.match(repo, pats, opts)
112 m = cmdutil.match(repo, pats, opts)
113 for src, abs in cmdutil.walk(repo, m, ctx.node()):
113 for src, abs in repo.walk(m, ctx.node()):
114 fctx = ctx.filectx(abs)
114 fctx = ctx.filectx(abs)
115 if not opts['text'] and util.binary(fctx.data()):
115 if not opts['text'] and util.binary(fctx.data()):
116 ui.write(_("%s: binary file\n") % ((pats and m.rel(abs)) or abs))
116 ui.write(_("%s: binary file\n") % ((pats and m.rel(abs)) or abs))
@@ -489,7 +489,7 b' def cat(ui, repo, file1, *pats, **opts):'
489 ctx = repo.changectx(opts['rev'])
489 ctx = repo.changectx(opts['rev'])
490 err = 1
490 err = 1
491 m = cmdutil.match(repo, (file1,) + pats, opts)
491 m = cmdutil.match(repo, (file1,) + pats, opts)
492 for src, abs in cmdutil.walk(repo, m, ctx.node()):
492 for src, abs in repo.walk(m, ctx.node()):
493 fp = cmdutil.make_file(repo, opts['output'], ctx.node(), pathname=abs)
493 fp = cmdutil.make_file(repo, opts['output'], ctx.node(), pathname=abs)
494 data = ctx.filectx(abs).data()
494 data = ctx.filectx(abs).data()
495 if opts.get('decode'):
495 if opts.get('decode'):
@@ -915,7 +915,7 b' def debugrename(ui, repo, file1, *pats, '
915
915
916 ctx = repo.changectx(opts.get('rev', 'tip'))
916 ctx = repo.changectx(opts.get('rev', 'tip'))
917 m = cmdutil.match(repo, (file1,) + pats, opts)
917 m = cmdutil.match(repo, (file1,) + pats, opts)
918 for src, abs in cmdutil.walk(repo, m, ctx.node()):
918 for src, abs in repo.walk(m, ctx.node()):
919 fctx = ctx.filectx(abs)
919 fctx = ctx.filectx(abs)
920 o = fctx.filelog().renamed(fctx.filenode())
920 o = fctx.filelog().renamed(fctx.filenode())
921 rel = m.rel(abs)
921 rel = m.rel(abs)
@@ -927,7 +927,7 b' def debugrename(ui, repo, file1, *pats, '
927 def debugwalk(ui, repo, *pats, **opts):
927 def debugwalk(ui, repo, *pats, **opts):
928 """show how files match on given patterns"""
928 """show how files match on given patterns"""
929 m = cmdutil.match(repo, pats, opts)
929 m = cmdutil.match(repo, pats, opts)
930 items = list(cmdutil.walk(repo, m))
930 items = list(repo.walk(m))
931 if not items:
931 if not items:
932 return
932 return
933 fmt = '%%s %%-%ds %%-%ds %%s' % (
933 fmt = '%%s %%-%ds %%-%ds %%s' % (
@@ -1699,7 +1699,7 b' def locate(ui, repo, *pats, **opts):'
1699 ret = 1
1699 ret = 1
1700 m = cmdutil.match(repo, pats, opts, default='relglob')
1700 m = cmdutil.match(repo, pats, opts, default='relglob')
1701 m.bad = lambda x,y: False
1701 m.bad = lambda x,y: False
1702 for src, abs in cmdutil.walk(repo, m, node):
1702 for src, abs in repo.walk(m, node):
1703 if not node and abs not in repo.dirstate:
1703 if not node and abs not in repo.dirstate:
1704 continue
1704 continue
1705 if opts['fullpath']:
1705 if opts['fullpath']:
@@ -2185,7 +2185,7 b' def remove(ui, repo, *pats, **opts):'
2185 modified, added, removed, deleted, unknown = mardu
2185 modified, added, removed, deleted, unknown = mardu
2186
2186
2187 remove, forget = [], []
2187 remove, forget = [], []
2188 for src, abs in cmdutil.walk(repo, m):
2188 for src, abs in repo.walk(m):
2189
2189
2190 reason = None
2190 reason = None
2191 if abs in removed or abs in unknown:
2191 if abs in removed or abs in unknown:
@@ -2342,7 +2342,7 b' def revert(ui, repo, *pats, **opts):'
2342
2342
2343 m = cmdutil.match(repo, pats, opts)
2343 m = cmdutil.match(repo, pats, opts)
2344 m.bad = lambda x,y: False
2344 m.bad = lambda x,y: False
2345 for src, abs in cmdutil.walk(repo, m):
2345 for src, abs in repo.walk(m):
2346 names[abs] = m.rel(abs), m.exact(abs)
2346 names[abs] = m.rel(abs), m.exact(abs)
2347
2347
2348 # walk target manifest.
2348 # walk target manifest.
@@ -2359,7 +2359,7 b' def revert(ui, repo, *pats, **opts):'
2359
2359
2360 m = cmdutil.match(repo, pats, opts)
2360 m = cmdutil.match(repo, pats, opts)
2361 m.bad = badfn
2361 m.bad = badfn
2362 for src, abs in cmdutil.walk(repo, m, node=node):
2362 for src, abs in repo.walk(m, node=node):
2363 if abs not in names:
2363 if abs not in names:
2364 names[abs] = m.rel(abs), m.exact(abs)
2364 names[abs] = m.rel(abs), m.exact(abs)
2365
2365
@@ -931,7 +931,7 b' class localrepository(repo.repository):'
931 self.dirstate.invalidate()
931 self.dirstate.invalidate()
932 del tr, lock, wlock
932 del tr, lock, wlock
933
933
934 def walk(self, node, match):
934 def walk(self, match, node=None):
935 '''
935 '''
936 walk recursively through the directory tree or a given
936 walk recursively through the directory tree or a given
937 changeset, finding all files matched by the match
937 changeset, finding all files matched by the match
General Comments 0
You need to be logged in to leave comments. Login now