Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 2883:c2932ad5476a
move commands.addremove_lock to cmdutil.addremove
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Sun, 13 Aug 2006 16:57:45 -0700 |
parents | cf98cd70d2c4 |
children | fcdcf0c19998 |
comparison
equal
deleted
inserted
replaced
2882:cf98cd70d2c4 | 2883:c2932ad5476a |
---|---|
88 | 88 |
89 def walk(repo, pats, opts, node=None, head='', badmatch=None): | 89 def walk(repo, pats, opts, node=None, head='', badmatch=None): |
90 files, matchfn, results = makewalk(repo, pats, opts, node, head, badmatch) | 90 files, matchfn, results = makewalk(repo, pats, opts, node, head, badmatch) |
91 for r in results: | 91 for r in results: |
92 yield r | 92 yield r |
93 | |
94 def addremove(repo, pats, opts={}, wlock=None, dry_run=None): | |
95 if dry_run is None: | |
96 dry_run = opts.get('dry_run') | |
97 add, remove = [], [] | |
98 for src, abs, rel, exact in walk(repo, pats, opts): | |
99 if src == 'f' and repo.dirstate.state(abs) == '?': | |
100 add.append(abs) | |
101 if repo.ui.verbose or not exact: | |
102 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) | |
103 if repo.dirstate.state(abs) != 'r' and not os.path.exists(rel): | |
104 remove.append(abs) | |
105 if repo.ui.verbose or not exact: | |
106 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs)) | |
107 if not dry_run: | |
108 repo.add(add, wlock=wlock) | |
109 repo.remove(remove, wlock=wlock) |