walk: remove cmdutil.walk
authorMatt Mackall <mpm@selenic.com>
Mon, 12 May 2008 11:37:08 -0500
changeset 6585 d3d1d39da2fa
parent 6584 29c77e5dfb3c
child 6586 d3463007d368
walk: remove cmdutil.walk
mercurial/cmdutil.py
mercurial/commands.py
mercurial/localrepo.py
--- a/mercurial/cmdutil.py	Mon May 12 11:37:08 2008 -0500
+++ b/mercurial/cmdutil.py	Mon May 12 11:37:08 2008 -0500
@@ -235,10 +235,6 @@
     m.bad = badfn
     return m
 
-def walk(repo, match, node=None):
-    for src, fn in repo.walk(node, match):
-        yield src, fn
-
 def findrenames(repo, added=None, removed=None, threshold=0.5):
     '''find renamed files -- yields (before, after, score) tuples'''
     if added is None or removed is None:
@@ -275,7 +271,7 @@
     add, remove = [], []
     mapping = {}
     m = match(repo, pats, opts)
-    for src, abs in walk(repo, m):
+    for src, abs in repo.walk(m):
         target = repo.wjoin(abs)
         rel = m.rel(abs)
         exact = m.exact(abs)
@@ -317,7 +313,7 @@
     def walkpat(pat):
         srcs = []
         m = match(repo, [pat], opts, globbed=True)
-        for tag, abs in walk(repo, m):
+        for tag, abs in repo.walk(m):
             state = repo.dirstate[abs]
             rel = m.rel(abs)
             exact = m.exact(abs)
--- a/mercurial/commands.py	Mon May 12 11:37:08 2008 -0500
+++ b/mercurial/commands.py	Mon May 12 11:37:08 2008 -0500
@@ -33,7 +33,7 @@
     names = []
     m = cmdutil.match(repo, pats, opts)
     m.bad = lambda x,y: True
-    for src, abs in cmdutil.walk(repo, m):
+    for src, abs in repo.walk(m):
         if m.exact(abs):
             if ui.verbose:
                 ui.status(_('adding %s\n') % m.rel(abs))
@@ -110,7 +110,7 @@
     ctx = repo.changectx(opts['rev'])
 
     m = cmdutil.match(repo, pats, opts)
-    for src, abs in cmdutil.walk(repo, m, ctx.node()):
+    for src, abs in repo.walk(m, ctx.node()):
         fctx = ctx.filectx(abs)
         if not opts['text'] and util.binary(fctx.data()):
             ui.write(_("%s: binary file\n") % ((pats and m.rel(abs)) or abs))
@@ -489,7 +489,7 @@
     ctx = repo.changectx(opts['rev'])
     err = 1
     m = cmdutil.match(repo, (file1,) + pats, opts)
-    for src, abs in cmdutil.walk(repo, m, ctx.node()):
+    for src, abs in repo.walk(m, ctx.node()):
         fp = cmdutil.make_file(repo, opts['output'], ctx.node(), pathname=abs)
         data = ctx.filectx(abs).data()
         if opts.get('decode'):
@@ -915,7 +915,7 @@
 
     ctx = repo.changectx(opts.get('rev', 'tip'))
     m = cmdutil.match(repo, (file1,) + pats, opts)
-    for src, abs in cmdutil.walk(repo, m, ctx.node()):
+    for src, abs in repo.walk(m, ctx.node()):
         fctx = ctx.filectx(abs)
         o = fctx.filelog().renamed(fctx.filenode())
         rel = m.rel(abs)
@@ -927,7 +927,7 @@
 def debugwalk(ui, repo, *pats, **opts):
     """show how files match on given patterns"""
     m = cmdutil.match(repo, pats, opts)
-    items = list(cmdutil.walk(repo, m))
+    items = list(repo.walk(m))
     if not items:
         return
     fmt = '%%s  %%-%ds  %%-%ds  %%s' % (
@@ -1699,7 +1699,7 @@
     ret = 1
     m = cmdutil.match(repo, pats, opts, default='relglob')
     m.bad = lambda x,y: False
-    for src, abs in cmdutil.walk(repo, m, node):
+    for src, abs in repo.walk(m, node):
         if not node and abs not in repo.dirstate:
             continue
         if opts['fullpath']:
@@ -2185,7 +2185,7 @@
     modified, added, removed, deleted, unknown = mardu
 
     remove, forget = [], []
-    for src, abs in cmdutil.walk(repo, m):
+    for src, abs in repo.walk(m):
 
         reason = None
         if abs in removed or abs in unknown:
@@ -2342,7 +2342,7 @@
 
         m = cmdutil.match(repo, pats, opts)
         m.bad = lambda x,y: False
-        for src, abs in cmdutil.walk(repo, m):
+        for src, abs in repo.walk(m):
             names[abs] = m.rel(abs), m.exact(abs)
 
         # walk target manifest.
@@ -2359,7 +2359,7 @@
 
         m = cmdutil.match(repo, pats, opts)
         m.bad = badfn
-        for src, abs in cmdutil.walk(repo, m, node=node):
+        for src, abs in repo.walk(m, node=node):
             if abs not in names:
                 names[abs] = m.rel(abs), m.exact(abs)
 
--- a/mercurial/localrepo.py	Mon May 12 11:37:08 2008 -0500
+++ b/mercurial/localrepo.py	Mon May 12 11:37:08 2008 -0500
@@ -931,7 +931,7 @@
                 self.dirstate.invalidate()
             del tr, lock, wlock
 
-    def walk(self, node, match):
+    def walk(self, match, node=None):
         '''
         walk recursively through the directory tree or a given
         changeset, finding all files matched by the match