Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 11223:0d09f2244805
rename: make --after work if source is already in R state
I routinely want to use `hg addrem` and then fix up missed renames
manually using `hg mv -A`. This patch allows me to record such
renames from a source in state R to a target in state A.
author | Peter Arrenbrecht <peter.arrenbrecht@gmail.com> |
---|---|
date | Wed, 26 May 2010 16:16:47 +0200 |
parents | 6a64813276ed |
children | 1107888a1ad1 |
comparison
equal
deleted
inserted
replaced
11222:e7adcef1504b | 11223:0d09f2244805 |
---|---|
349 after = opts.get("after") | 349 after = opts.get("after") |
350 dryrun = opts.get("dry_run") | 350 dryrun = opts.get("dry_run") |
351 | 351 |
352 def walkpat(pat): | 352 def walkpat(pat): |
353 srcs = [] | 353 srcs = [] |
354 badstates = after and '?' or '?r' | |
354 m = match(repo, [pat], opts, globbed=True) | 355 m = match(repo, [pat], opts, globbed=True) |
355 for abs in repo.walk(m): | 356 for abs in repo.walk(m): |
356 state = repo.dirstate[abs] | 357 state = repo.dirstate[abs] |
357 rel = m.rel(abs) | 358 rel = m.rel(abs) |
358 exact = m.exact(abs) | 359 exact = m.exact(abs) |
359 if state in '?r': | 360 if state in badstates: |
360 if exact and state == '?': | 361 if exact and state == '?': |
361 ui.warn(_('%s: not copying - file is not managed\n') % rel) | 362 ui.warn(_('%s: not copying - file is not managed\n') % rel) |
362 if exact and state == 'r': | 363 if exact and state == 'r': |
363 ui.warn(_('%s: not copying - file has been marked for' | 364 ui.warn(_('%s: not copying - file has been marked for' |
364 ' remove\n') % rel) | 365 ' remove\n') % rel) |