Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 5688:883d887c6408
commands: add exits(1) if a specified file cannot be added (issue 891)
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Mon, 24 Dec 2007 12:14:43 +0100 |
parents | 3c80ecdc1bcd |
children | be367cbafe70 |
comparison
equal
deleted
inserted
replaced
5687:ca7af19debea | 5688:883d887c6408 |
---|---|
24 undo an add before that, see hg revert. | 24 undo an add before that, see hg revert. |
25 | 25 |
26 If no names are given, add all files in the repository. | 26 If no names are given, add all files in the repository. |
27 """ | 27 """ |
28 | 28 |
29 rejected = None | |
30 exacts = {} | |
29 names = [] | 31 names = [] |
30 for src, abs, rel, exact in cmdutil.walk(repo, pats, opts): | 32 for src, abs, rel, exact in cmdutil.walk(repo, pats, opts, |
33 badmatch=util.always): | |
31 if exact: | 34 if exact: |
32 if ui.verbose: | 35 if ui.verbose: |
33 ui.status(_('adding %s\n') % rel) | 36 ui.status(_('adding %s\n') % rel) |
34 names.append(abs) | 37 names.append(abs) |
38 exacts[abs] = 1 | |
35 elif abs not in repo.dirstate: | 39 elif abs not in repo.dirstate: |
36 ui.status(_('adding %s\n') % rel) | 40 ui.status(_('adding %s\n') % rel) |
37 names.append(abs) | 41 names.append(abs) |
38 if not opts.get('dry_run'): | 42 if not opts.get('dry_run'): |
39 repo.add(names) | 43 rejected = repo.add(names) |
44 rejected = [p for p in rejected if p in exacts] | |
45 return rejected and 1 or 0 | |
40 | 46 |
41 def addremove(ui, repo, *pats, **opts): | 47 def addremove(ui, repo, *pats, **opts): |
42 """add all new files, delete all missing files | 48 """add all new files, delete all missing files |
43 | 49 |
44 Add all new files and remove all missing files from the repository. | 50 Add all new files and remove all missing files from the repository. |