--- a/mercurial/commands.py Tue Nov 08 10:35:05 2005 -0800
+++ b/mercurial/commands.py Tue Nov 08 10:35:09 2005 -0800
@@ -803,10 +803,13 @@
def copy(abssrc, relsrc, target, exact):
abstarget = util.canonpath(repo.root, cwd, target)
reltarget = util.pathto(cwd, abstarget)
- if not opts['force'] and repo.dirstate.state(abstarget) not in 'a?':
- ui.warn(_('%s: not overwriting - file already managed\n') %
- reltarget)
- return
+ if os.path.exists(reltarget):
+ if opts['force']:
+ os.unlink(reltarget)
+ else:
+ ui.warn(_('%s: not overwriting - file exists\n') %
+ reltarget)
+ return
if ui.verbose or not exact:
ui.status(_('copying %s to %s\n') % (relsrc, reltarget))
if not opts['after']: