# HG changeset patch # User Matt Mackall # Date 1210610228 18000 # Node ID d3463007d368b27c1a319b52428632e316268a03 # Parent d3d1d39da2faad013b420507c9526b945f25ebb7 walk: return a single value diff -r d3d1d39da2fa -r d3463007d368 mercurial/cmdutil.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 @@ -271,11 +271,11 @@ add, remove = [], [] mapping = {} m = match(repo, pats, opts) - for src, abs in repo.walk(m): + for abs in repo.walk(m): target = repo.wjoin(abs) rel = m.rel(abs) exact = m.exact(abs) - if src == 'f' and abs not in repo.dirstate: + if abs not in repo.dirstate: add.append(abs) mapping[abs] = rel, m.exact(abs) if repo.ui.verbose or not exact: @@ -313,7 +313,7 @@ def walkpat(pat): srcs = [] m = match(repo, [pat], opts, globbed=True) - for tag, abs in repo.walk(m): + for abs in repo.walk(m): state = repo.dirstate[abs] rel = m.rel(abs) exact = m.exact(abs) diff -r d3d1d39da2fa -r d3463007d368 mercurial/commands.py --- 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 repo.walk(m): + for 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 repo.walk(m, ctx.node()): + for 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 repo.walk(m, ctx.node()): + for 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 repo.walk(m, ctx.node()): + for abs in repo.walk(m, ctx.node()): fctx = ctx.filectx(abs) o = fctx.filelog().renamed(fctx.filenode()) rel = m.rel(abs) @@ -930,11 +930,11 @@ items = list(repo.walk(m)) if not items: return - fmt = '%%s %%-%ds %%-%ds %%s' % ( - max([len(abs) for (src, abs) in items]), - max([len(m.rel(abs)) for (src, abs) in items])) - for src, abs in items: - line = fmt % (src, abs, m.rel(abs), m.exact(abs) and 'exact' or '') + fmt = 'f %%-%ds %%-%ds %%s' % ( + max([len(abs) for abs in items]), + max([len(m.rel(abs)) for abs in items])) + for abs in items: + line = fmt % (abs, m.rel(abs), m.exact(abs) and 'exact' or '') ui.write("%s\n" % line.rstrip()) def diff(ui, repo, *pats, **opts): @@ -1699,7 +1699,7 @@ ret = 1 m = cmdutil.match(repo, pats, opts, default='relglob') m.bad = lambda x,y: False - for src, abs in repo.walk(m, node): + for 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 repo.walk(m): + for 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 repo.walk(m): + for 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 repo.walk(m, node=node): + for abs in repo.walk(m, node=node): if abs not in names: names[abs] = m.rel(abs), m.exact(abs) diff -r d3d1d39da2fa -r d3463007d368 mercurial/localrepo.py --- a/mercurial/localrepo.py Mon May 12 11:37:08 2008 -0500 +++ b/mercurial/localrepo.py Mon May 12 11:37:08 2008 -0500 @@ -936,11 +936,6 @@ walk recursively through the directory tree or a given changeset, finding all files matched by the match function - - results are yielded in a tuple (src, filename), where src - is one of: - 'f' the file was found in the directory tree - 'm' the file was only in the dirstate and not in the tree ''' if node: @@ -958,16 +953,16 @@ del fdict[ffn] break if match(fn): - yield 'm', fn + yield fn ffiles = fdict.keys() ffiles.sort() for fn in ffiles: if match.bad(fn, 'No such file in rev ' + short(node)) \ and match(fn): - yield 'f', fn + yield fn else: for src, fn in self.dirstate.walk(match): - yield src, fn + yield fn def status(self, node1=None, node2=None, files=[], match=util.always, list_ignored=False, list_clean=False, list_unknown=True): diff -r d3d1d39da2fa -r d3463007d368 tests/test-walk.out --- a/tests/test-walk.out Mon May 12 11:37:08 2008 -0500 +++ b/tests/test-walk.out Mon May 12 11:37:08 2008 -0500 @@ -275,10 +275,10 @@ fifo: unsupported file type (type is fifo) hg debugwalk fenugreek -m fenugreek fenugreek exact +f fenugreek fenugreek exact hg debugwalk fenugreek -m fenugreek fenugreek exact +f fenugreek fenugreek exact hg debugwalk new f new new exact