Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cmdutil.py @ 4906:30847b8af7ca
dirstate: add __contains__ and make __getitem__ more useful
dirstate.state(f) == '?' -> f not in dirstate
dirstate.state(f) -> dirstate[f]
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 21 Jul 2007 16:02:09 -0500 |
parents | 0e2d0a78f81a |
children | 126f527b3ba3 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Sat Jul 21 16:02:09 2007 -0500 +++ b/mercurial/cmdutil.py Sat Jul 21 16:02:09 2007 -0500 @@ -638,12 +638,12 @@ mapping = {} for src, abs, rel, exact in walk(repo, pats, opts): target = repo.wjoin(abs) - if src == 'f' and repo.dirstate.state(abs) == '?': + if src == 'f' and abs not in repo.dirstate: add.append(abs) mapping[abs] = rel, exact if repo.ui.verbose or not exact: repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) - if repo.dirstate.state(abs) != 'r' and not util.lexists(target): + if repo.dirstate[abs] != 'r' and not util.lexists(target): remove.append(abs) mapping[abs] = rel, exact if repo.ui.verbose or not exact: