comparison mercurial/cmdutil.py @ 12269:877236cdd437

add: move main part to cmdutil to make it easier to reuse
author Martin Geisler <mg@lazybytes.net>
date Mon, 13 Sep 2010 13:09:11 +0200
parents 00658492e2aa
children 166b9866580a
comparison
equal deleted inserted replaced
12268:83aaeba32b88 12269:877236cdd437
1278 prepare(ctx, fns) 1278 prepare(ctx, fns)
1279 for rev in nrevs: 1279 for rev in nrevs:
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')
1286 if date: 1302 if date:
1287 opts['date'] = util.parsedate(date) 1303 opts['date'] = util.parsedate(date)