Mercurial > hg
changeset 38276:fa4a286410a5
locate: explicitly use dirstate.matches() for working copy
`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.
Differential Revision: https://phab.mercurial-scm.org/D3710
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Mon, 11 Jun 2018 09:47:07 -0700 |
parents | f1d55ae2c5c8 |
children | aaed058a0390 |
files | mercurial/commands.py |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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: