Mercurial > hg
comparison mercurial/commands.py @ 14604:b1a534335548
forget, remove: don't note on nonexistent file twice
before:
$ hg forget foo
foo: No such file or directory
not removing foo: file is already untracked
after:
$ hg forget foo
foo: No such file or directory
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Mon, 13 Jun 2011 14:56:00 +0300 |
parents | 65f4512e40e4 |
children | 5d6244930559 |
comparison
equal
deleted
inserted
replaced
14603:68a43fdd7d80 | 14604:b1a534335548 |
---|---|
2270 forget = sorted(s[0] + s[1] + s[3] + s[6]) | 2270 forget = sorted(s[0] + s[1] + s[3] + s[6]) |
2271 errs = 0 | 2271 errs = 0 |
2272 | 2272 |
2273 for f in m.files(): | 2273 for f in m.files(): |
2274 if f not in repo.dirstate and not os.path.isdir(m.rel(f)): | 2274 if f not in repo.dirstate and not os.path.isdir(m.rel(f)): |
2275 ui.warn(_('not removing %s: file is already untracked\n') | 2275 if os.path.exists(m.rel(f)): |
2276 % m.rel(f)) | 2276 ui.warn(_('not removing %s: file is already untracked\n') |
2277 % m.rel(f)) | |
2277 errs = 1 | 2278 errs = 1 |
2278 | 2279 |
2279 for f in forget: | 2280 for f in forget: |
2280 if ui.verbose or not m.exact(f): | 2281 if ui.verbose or not m.exact(f): |
2281 ui.status(_('removing %s\n') % m.rel(f)) | 2282 ui.status(_('removing %s\n') % m.rel(f)) |
3915 s = repo.status(match=m, clean=True) | 3916 s = repo.status(match=m, clean=True) |
3916 modified, added, deleted, clean = s[0], s[1], s[3], s[6] | 3917 modified, added, deleted, clean = s[0], s[1], s[3], s[6] |
3917 | 3918 |
3918 for f in m.files(): | 3919 for f in m.files(): |
3919 if f not in repo.dirstate and not os.path.isdir(m.rel(f)): | 3920 if f not in repo.dirstate and not os.path.isdir(m.rel(f)): |
3920 ui.warn(_('not removing %s: file is untracked\n') % m.rel(f)) | 3921 if os.path.exists(m.rel(f)): |
3922 ui.warn(_('not removing %s: file is untracked\n') % m.rel(f)) | |
3921 ret = 1 | 3923 ret = 1 |
3922 | 3924 |
3923 if force: | 3925 if force: |
3924 list = modified + deleted + clean + added | 3926 list = modified + deleted + clean + added |
3925 elif after: | 3927 elif after: |