diff mercurial/narrowspec.py @ 42171:84bd6ae2d1f6

narrow: also warn when not deleting untracked or ignored files Differential Revision: https://phab.mercurial-scm.org/D6265
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 17 Apr 2019 10:49:11 -0700
parents 770f5f586ae5
children 0c0a22f5b0b5
line wrap: on
line diff
--- a/mercurial/narrowspec.py	Wed Apr 17 14:37:06 2019 +0200
+++ b/mercurial/narrowspec.py	Wed Apr 17 10:49:11 2019 -0700
@@ -293,8 +293,8 @@
     removedmatch = matchmod.differencematcher(oldmatch, newmatch)
 
     ds = repo.dirstate
-    lookup, status = ds.status(removedmatch, subrepos=[], ignored=False,
-                               clean=True, unknown=False)
+    lookup, status = ds.status(removedmatch, subrepos=[], ignored=True,
+                               clean=True, unknown=True)
     trackeddirty = status.modified + status.added
     clean = status.clean
     if assumeclean:
@@ -306,6 +306,10 @@
     uipathfn = scmutil.getuipathfn(repo)
     for f in sorted(trackeddirty):
         repo.ui.status(_('not deleting possibly dirty file %s\n') % uipathfn(f))
+    for f in sorted(status.unknown):
+        repo.ui.status(_('not deleting unknown file %s\n') % uipathfn(f))
+    for f in sorted(status.ignored):
+        repo.ui.status(_('not deleting ignored file %s\n') % uipathfn(f))
     for f in clean + trackeddirty:
         ds.drop(f)