mercurial/commands.py
changeset 38276 fa4a286410a5
parent 38238 2b8c8b8d1a06
child 38279 a8e7ea176437
--- a/mercurial/commands.py	Mon Jun 11 11:37:21 2018 -0700
+++ b/mercurial/commands.py	Mon Jun 11 09:47:07 2018 -0700
@@ -3333,7 +3333,13 @@
                       badfn=lambda x, y: False)
 
     ui.pager('locate')
-    for abs in ctx.matches(m):
+    if ctx.rev() is None:
+        # When run on the working copy, "locate" includes removed files, so
+        # we get the list of files from the dirstate.
+        filesgen = sorted(repo.dirstate.matches(m))
+    else:
+        filesgen = ctx.matches(m)
+    for abs in filesgen:
         if opts.get('fullpath'):
             ui.write(repo.wjoin(abs), end)
         else: