changeset 8533:6062c6362b2e

remove: warn if unversionned files are specified (issue1454)
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Wed, 20 May 2009 21:16:04 +0200
parents b97e2417ae53
children 22ec9cf4d0ce
files mercurial/commands.py tests/test-remove.out
diffstat 2 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Wed May 20 19:37:25 2009 +0200
+++ b/mercurial/commands.py	Wed May 20 21:16:04 2009 +0200
@@ -2311,6 +2311,10 @@
     s = repo.status(match=m, clean=True)
     modified, added, deleted, clean = s[0], s[1], s[3], s[6]
 
+    for f in m.files():
+        if f not in repo.dirstate and not os.path.isdir(m.rel(f)):
+            ui.warn(_('not removing %s: file is untracked\n') % m.rel(f))
+
     def warn(files, reason):
         for f in files:
             ui.warn(_('not removing %s: file %s (use -f to force removal)\n')
--- a/tests/test-remove.out	Wed May 20 19:37:25 2009 +0200
+++ b/tests/test-remove.out	Wed May 20 21:16:04 2009 +0200
@@ -1,4 +1,5 @@
 % file not managed
+not removing foo: file is untracked
 ? foo
 ./foo
 0 files updated, 0 files merged, 0 files removed, 0 files unresolved