changeset 6656:2cbe0f72c379

Merge with crew-stable
author Patrick Mezard <pmezard@gmail.com>
date Sat, 07 Jun 2008 11:43:16 +0200
parents ab798a37b846 (current diff) 7f0dd352fb4d (diff)
children a51093361e1c
files mercurial/cmdutil.py
diffstat 3 files changed, 29 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Tue Jun 03 21:20:52 2008 +0200
+++ b/mercurial/cmdutil.py	Sat Jun 07 11:43:16 2008 +0200
@@ -276,17 +276,23 @@
         similarity = float(opts.get('similarity') or 0)
     add, remove = [], []
     mapping = {}
+    audit_path = util.path_auditor(repo.root)
     m = match(repo, pats, opts)
     for abs in repo.walk(m):
         target = repo.wjoin(abs)
+        good = True
+        try:
+            audit_path(abs)
+        except:
+            good = False
         rel = m.rel(abs)
         exact = m.exact(abs)
-        if abs not in repo.dirstate:
+        if good and abs not in repo.dirstate:
             add.append(abs)
             mapping[abs] = rel, m.exact(abs)
             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 good or not util.lexists(target)
             or (os.path.isdir(target) and not os.path.islink(target))):
             remove.append(abs)
             mapping[abs] = rel, exact
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-symlink-addremove	Sat Jun 07 11:43:16 2008 +0200
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+"$TESTDIR/hghave" symlink || exit 80
+
+hg init a
+cd a
+
+echo '% directory moved and symlinked'
+mkdir foo
+touch foo/a
+hg ci -Ama
+mv foo bar
+ln -s bar foo
+echo '% now addremove should remove old files'
+hg addremove
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-symlink-addremove.out	Sat Jun 07 11:43:16 2008 +0200
@@ -0,0 +1,6 @@
+% directory moved and symlinked
+adding foo/a
+% now addremove should remove old files
+adding bar/a
+adding foo
+removing foo/a