forget: cleanup the output for an inexact case match on icasefs stable
authorMatt Harbison <matt_harbison@yahoo.com>
Tue, 31 Mar 2015 17:42:46 -0400
branchstable
changeset 24548 c780a63f61ca
parent 24537 2bb13f2b778c
child 24554 6e73c66a6919
child 24556 2e2e9a0750f9
forget: cleanup the output for an inexact case match on icasefs Previously, specifying a file name but not matching the dirstate case yielded the following, even though the file was actually removed: $ hg forget capsdir1/capsdir/abc.txt not removing capsdir\a.txt: file is already untracked removing CapsDir\A.txt [1] This change doesn't appear to cause any extra filesystem accesses, even if a nonexistant file is specified. If a directory is specified without a case match, it is (and was previously) still silently ignored.
mercurial/cmdutil.py
tests/test-add.t
--- a/mercurial/cmdutil.py	Tue Mar 31 11:11:39 2015 -0400
+++ b/mercurial/cmdutil.py	Tue Mar 31 17:42:46 2015 -0400
@@ -2044,6 +2044,12 @@
             if f not in repo.dirstate and not repo.wvfs.isdir(f):
                 if f not in forgot:
                     if repo.wvfs.exists(f):
+                        # Don't complain if the exact case match wasn't given.
+                        # But don't do this until after checking 'forgot', so
+                        # that subrepo files aren't normalized, and this op is
+                        # purely from data cached by the status walk above.
+                        if repo.dirstate.normalize(f) in repo.dirstate:
+                            continue
                         ui.warn(_('not removing %s: '
                                   'file is already untracked\n')
                                 % match.rel(f))
--- a/tests/test-add.t	Tue Mar 31 11:11:39 2015 -0400
+++ b/tests/test-add.t	Tue Mar 31 17:42:46 2015 -0400
@@ -179,6 +179,9 @@
   $ hg add -v capsdir1/capsdir
   adding CapsDir1/CapsDir/AbC.txt (glob)
   adding CapsDir1/CapsDir/SubDir/Def.txt (glob)
+
+  $ hg forget capsdir1/capsdir/abc.txt
+  removing CapsDir1/CapsDir/AbC.txt (glob)
 #endif
 
   $ cd ..