D3710: locate: explicitly use dirstate.matches() for working copy

2018-06-12 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGfa4a286410a5: locate: explicitly use dirstate.matches() for 
working copy (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3710?vs=9009=9018

REVISION DETAIL
  https://phab.mercurial-scm.org/D3710

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -,7 +,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:



To: martinvonz, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3710: locate: explicitly use dirstate.matches() for working copy

2018-06-11 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  `hg locate` is odd in that it includes files that have been removed
  from the working copy. It relies on workingctx.matches() for that. I
  want to make workingctx.matches() not include removed files, so this
  patch makes `hg locate` handle the working copy differently instead.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3710

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -,7 +,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:



To: martinvonz, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel