[Bug 6886] New: hg grep from a subdirectory shows paths relative to repo root, not subdirectory
mercurial-bugs at mercurial-scm.org
mercurial-bugs at mercurial-scm.org
Tue Jul 9 13:57:42 UTC 2024
https://bz.mercurial-scm.org/show_bug.cgi?id=6886
Bug ID: 6886
Summary: hg grep from a subdirectory shows paths relative to
repo root, not subdirectory
Product: Mercurial
Version: 6.7.4
Hardware: PC
OS: NetBSD
Status: UNCONFIRMED
Severity: feature
Priority: wish
Component: Mercurial
Assignee: bugzilla at mercurial-scm.org
Reporter: mercurial-bugzilla at campbell.mumble.net
CC: mercurial-devel at mercurial-scm.org
Python Version: ---
Given a repository with some matching test in a file in a subdirectory:
$ hg init
$ mkdir foo bar
$ echo hello >foo/baz
$ echo hello >bar/quux
$ hg add foo bar
adding bar/quux
adding foo/baz
$ hg commit -m mumble
hg grep always shows paths relative to the repository root, even if run from
within the subdirectory and restricted to that one:
$ hg grep hello .
bar/quux:hello
foo/baz:hello
$ cd foo
$ hg grep hello .
foo/baz:hello
Desired output:
$ hg grep hello .
bar/quux:hello
foo/baz:hello
$ cd foo
$ hg grep hello .
baz:hello
This better matches the behaviour of grep (and git grep), e.g. the output can
be piped to another program that operates on the listed files without having to
cd to the repo root first.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Mercurial-devel
mailing list