Mercurial > hg
comparison mercurial/cmdutil.py @ 8988:1247751d9bf8
addremove: normalize some variable names
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 30 Jun 2009 15:56:08 -0500 |
parents | c68ccda3451b |
children | 85b81cac9613 |
comparison
equal
deleted
inserted
replaced
8987:c68ccda3451b | 8988:1247751d9bf8 |
---|---|
295 def addremove(repo, pats=[], opts={}, dry_run=None, similarity=None): | 295 def addremove(repo, pats=[], opts={}, dry_run=None, similarity=None): |
296 if dry_run is None: | 296 if dry_run is None: |
297 dry_run = opts.get('dry_run') | 297 dry_run = opts.get('dry_run') |
298 if similarity is None: | 298 if similarity is None: |
299 similarity = float(opts.get('similarity') or 0) | 299 similarity = float(opts.get('similarity') or 0) |
300 add, remove = [], [] | 300 unknown, deleted = [], [] |
301 audit_path = util.path_auditor(repo.root) | 301 audit_path = util.path_auditor(repo.root) |
302 m = match(repo, pats, opts) | 302 m = match(repo, pats, opts) |
303 for abs in repo.walk(m): | 303 for abs in repo.walk(m): |
304 target = repo.wjoin(abs) | 304 target = repo.wjoin(abs) |
305 good = True | 305 good = True |
308 except: | 308 except: |
309 good = False | 309 good = False |
310 rel = m.rel(abs) | 310 rel = m.rel(abs) |
311 exact = m.exact(abs) | 311 exact = m.exact(abs) |
312 if good and abs not in repo.dirstate: | 312 if good and abs not in repo.dirstate: |
313 add.append(abs) | 313 unknown.append(abs) |
314 if repo.ui.verbose or not exact: | 314 if repo.ui.verbose or not exact: |
315 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) | 315 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) |
316 if repo.dirstate[abs] != 'r' and (not good or not util.lexists(target) | 316 if repo.dirstate[abs] != 'r' and (not good or not util.lexists(target) |
317 or (os.path.isdir(target) and not os.path.islink(target))): | 317 or (os.path.isdir(target) and not os.path.islink(target))): |
318 remove.append(abs) | 318 deleted.append(abs) |
319 if repo.ui.verbose or not exact: | 319 if repo.ui.verbose or not exact: |
320 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs)) | 320 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs)) |
321 if not dry_run: | 321 if not dry_run: |
322 repo.remove(remove) | 322 repo.remove(deleted) |
323 repo.add(add) | 323 repo.add(unknown) |
324 if similarity > 0: | 324 if similarity > 0: |
325 for old, new, score in findrenames(repo, m, similarity): | 325 for old, new, score in findrenames(repo, m, similarity): |
326 if repo.ui.verbose or not m.exact(old) or not m.exact(new): | 326 if repo.ui.verbose or not m.exact(old) or not m.exact(new): |
327 repo.ui.status(_('recording removal of %s as rename to %s ' | 327 repo.ui.status(_('recording removal of %s as rename to %s ' |
328 '(%d%% similar)\n') % | 328 '(%d%% similar)\n') % |