--- a/mercurial/cmdutil.py Sat Nov 03 17:04:42 2007 +0100
+++ b/mercurial/cmdutil.py Mon Nov 05 20:05:44 2007 +0300
@@ -266,14 +266,15 @@
mapping[abs] = rel, exact
if repo.ui.verbose or not exact:
repo.ui.status(_('adding %s\n') % ((pats and rel) or abs))
- if repo.dirstate[abs] != 'r' and not util.lexists(target):
+ if repo.dirstate[abs] != 'r' and (not util.lexists(target)
+ or (os.path.isdir(target) and not os.path.islink(target))):
remove.append(abs)
mapping[abs] = rel, exact
if repo.ui.verbose or not exact:
repo.ui.status(_('removing %s\n') % ((pats and rel) or abs))
if not dry_run:
+ repo.remove(remove)
repo.add(add)
- repo.remove(remove)
if similarity > 0:
for old, new, score in findrenames(repo, add, remove, similarity):
oldrel, oldexact = mapping[old]