396 origsrc = repo.dirstate.copied(abssrc) or abssrc |
396 origsrc = repo.dirstate.copied(abssrc) or abssrc |
397 if abstarget == origsrc: # copying back a copy? |
397 if abstarget == origsrc: # copying back a copy? |
398 if state not in 'mn' and not dryrun: |
398 if state not in 'mn' and not dryrun: |
399 repo.dirstate.normallookup(abstarget) |
399 repo.dirstate.normallookup(abstarget) |
400 else: |
400 else: |
401 if repo.dirstate[origsrc] == 'a': |
401 if repo.dirstate[origsrc] == 'a' and origsrc == abssrc: |
402 if not ui.quiet: |
402 if not ui.quiet: |
403 ui.warn(_("%s has not been committed yet, so no copy " |
403 ui.warn(_("%s has not been committed yet, so no copy " |
404 "data will be stored for %s.\n") |
404 "data will be stored for %s.\n") |
405 % (repo.pathto(origsrc, cwd), reltarget)) |
405 % (repo.pathto(origsrc, cwd), reltarget)) |
406 if abstarget not in repo.dirstate and not dryrun: |
406 if repo.dirstate[abstarget] in '?r' and not dryrun: |
407 repo.add([abstarget]) |
407 repo.add([abstarget]) |
408 elif not dryrun: |
408 elif not dryrun: |
409 repo.copy(origsrc, abstarget) |
409 repo.copy(origsrc, abstarget) |
410 |
410 |
411 if rename and not dryrun: |
411 if rename and not dryrun: |