comparison mercurial/cmdutil.py @ 4950: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
comparison
equal deleted inserted replaced
4949:fc61495ea9cf 4950:30847b8af7ca
636 similarity = float(opts.get('similarity') or 0) 636 similarity = float(opts.get('similarity') or 0)
637 add, remove = [], [] 637 add, remove = [], []
638 mapping = {} 638 mapping = {}
639 for src, abs, rel, exact in walk(repo, pats, opts): 639 for src, abs, rel, exact in walk(repo, pats, opts):
640 target = repo.wjoin(abs) 640 target = repo.wjoin(abs)
641 if src == 'f' and repo.dirstate.state(abs) == '?': 641 if src == 'f' and abs not in repo.dirstate:
642 add.append(abs) 642 add.append(abs)
643 mapping[abs] = rel, exact 643 mapping[abs] = rel, exact
644 if repo.ui.verbose or not exact: 644 if repo.ui.verbose or not exact:
645 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) 645 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs))
646 if repo.dirstate.state(abs) != 'r' and not util.lexists(target): 646 if repo.dirstate[abs] != 'r' and not util.lexists(target):
647 remove.append(abs) 647 remove.append(abs)
648 mapping[abs] = rel, exact 648 mapping[abs] = rel, exact
649 if repo.ui.verbose or not exact: 649 if repo.ui.verbose or not exact:
650 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs)) 650 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs))
651 if not dry_run: 651 if not dry_run: