diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1624,7 +1624,10 @@ def locate(ui, repo, *pats, **opts): ret = 1 for src, abs, rel, exact in cmdutil.walk(repo, pats, opts, node=node, + badmatch=util.always, default='relglob'): + if src == 'b': + continue if not node and repo.dirstate.state(abs) == '?': continue if opts['fullpath']: diff --git a/tests/test-locate b/tests/test-locate --- a/tests/test-locate +++ b/tests/test-locate @@ -30,9 +30,11 @@ hg rm a hg ci -m m -d "1000000 0" hglocate a hglocate NONEXISTENT +hglocate relpath:NONEXISTENT hglocate hglocate -r 0 a hglocate -r 0 NONEXISTENT +hglocate -r 0 relpath:NONEXISTENT hglocate -r 0 echo % -I/-X with relative path should work cd t diff --git a/tests/test-locate.out b/tests/test-locate.out --- a/tests/test-locate.out +++ b/tests/test-locate.out @@ -25,6 +25,8 @@ hg locate a hg locate NONEXISTENT +hg locate relpath:NONEXISTENT + hg locate b dir.h/foo @@ -38,6 +40,8 @@ a hg locate -r 0 NONEXISTENT +hg locate -r 0 relpath:NONEXISTENT + hg locate -r 0 a b