Show More
@@ -1280,6 +1280,22 b' def walkchangerevs(repo, match, opts, pr' | |||||
1280 | yield change(rev) |
|
1280 | yield change(rev) | |
1281 | return iterate() |
|
1281 | return iterate() | |
1282 |
|
1282 | |||
|
1283 | def add(ui, repo, match, dryrun): | |||
|
1284 | bad = [] | |||
|
1285 | oldbad = match.bad | |||
|
1286 | match.bad = lambda x, y: bad.append(x) or oldbad(x, y) | |||
|
1287 | names = [] | |||
|
1288 | for f in repo.walk(match): | |||
|
1289 | exact = match.exact(f) | |||
|
1290 | if exact or f not in repo.dirstate: | |||
|
1291 | names.append(f) | |||
|
1292 | if ui.verbose or not exact: | |||
|
1293 | ui.status(_('adding %s\n') % match.rel(f)) | |||
|
1294 | if not dryrun: | |||
|
1295 | rejected = repo[None].add(names) | |||
|
1296 | bad.extend(f for f in rejected if f in match.files()) | |||
|
1297 | return bad | |||
|
1298 | ||||
1283 | def commit(ui, repo, commitfunc, pats, opts): |
|
1299 | def commit(ui, repo, commitfunc, pats, opts): | |
1284 | '''commit the specified files or all outstanding changes''' |
|
1300 | '''commit the specified files or all outstanding changes''' | |
1285 | date = opts.get('date') |
|
1301 | date = opts.get('date') |
@@ -46,22 +46,9 b' def add(ui, repo, *pats, **opts):' | |||||
46 | Returns 0 if all files are successfully added. |
|
46 | Returns 0 if all files are successfully added. | |
47 | """ |
|
47 | """ | |
48 |
|
48 | |||
49 | bad = [] |
|
|||
50 | names = [] |
|
|||
51 | m = cmdutil.match(repo, pats, opts) |
|
49 | m = cmdutil.match(repo, pats, opts) | |
52 | oldbad = m.bad |
|
50 | rejected = cmdutil.add(ui, repo, m, opts.get('dry_run')) | |
53 | m.bad = lambda x, y: bad.append(x) or oldbad(x, y) |
|
51 | return rejected and 1 or 0 | |
54 |
|
||||
55 | for f in repo.walk(m): |
|
|||
56 | exact = m.exact(f) |
|
|||
57 | if exact or f not in repo.dirstate: |
|
|||
58 | names.append(f) |
|
|||
59 | if ui.verbose or not exact: |
|
|||
60 | ui.status(_('adding %s\n') % m.rel(f)) |
|
|||
61 | if not opts.get('dry_run'): |
|
|||
62 | rejected = repo[None].add(names) |
|
|||
63 | bad += [f for f in rejected if f in m.files()] |
|
|||
64 | return bad and 1 or 0 |
|
|||
65 |
|
52 | |||
66 | def addremove(ui, repo, *pats, **opts): |
|
53 | def addremove(ui, repo, *pats, **opts): | |
67 | """add all new files, delete all missing files |
|
54 | """add all new files, delete all missing files |
General Comments 0
You need to be logged in to leave comments.
Login now