Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/commands.py Mon Dec 24 01:50:07 2007 +0100 +++ b/mercurial/commands.py Mon Dec 24 12:14:43 2007 +0100 @@ -26,17 +26,23 @@ If no names are given, add all files in the repository. """ + rejected = None + exacts = {} names = [] - for src, abs, rel, exact in cmdutil.walk(repo, pats, opts): + for src, abs, rel, exact in cmdutil.walk(repo, pats, opts, + badmatch=util.always): if exact: if ui.verbose: ui.status(_('adding %s\n') % rel) names.append(abs) + exacts[abs] = 1 elif abs not in repo.dirstate: ui.status(_('adding %s\n') % rel) names.append(abs) if not opts.get('dry_run'): - repo.add(names) + rejected = repo.add(names) + rejected = [p for p in rejected if p in exacts] + return rejected and 1 or 0 def addremove(ui, repo, *pats, **opts): """add all new files, delete all missing files