[Request] [+ ] D11495: Make hg manifest only print things inside the narrowspec
charlesetc (Charles Chamberlain)
phabricator at mercurial-scm.org
Thu Sep 23 17:51:37 UTC 2021
charlesetc created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
The performance of these commands seem roughly unchanged from the manual
testing I've done.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D11495
AFFECTED FILES
mercurial/commands.py
tests/test-narrow.t
CHANGE DETAILS
diff --git a/tests/test-narrow.t b/tests/test-narrow.t
--- a/tests/test-narrow.t
+++ b/tests/test-narrow.t
@@ -539,3 +539,13 @@
deleting meta/d0/00manifest.i (tree !)
deleting unwanted files from working copy
not deleting possibly dirty file d0/f
+
+
+Test manifest only prints files inside the narrowspec
+
+ $ hg status
+ $ hg tracked -q --addinclude "" --addexclude d2
+ $ { hg manifest ; hg manifest -r . ; hg manifest --all ; } | grep -e d2 -e d4
+ d4/f
+ d4/f
+ d4/f
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4764,6 +4764,7 @@
opts = pycompat.byteskwargs(opts)
fm = ui.formatter(b'manifest', opts)
+ m = repo.narrowmatch()
if opts.get(b'all'):
if rev or node:
raise error.InputError(_(b"can't specify a revision with --all"))
@@ -4771,7 +4772,9 @@
res = set()
for rev in repo:
ctx = repo[rev]
- res |= set(ctx.files())
+ files = ctx.files()
+ files = filter(m, files)
+ res |= set(files)
ui.pager(b'manifest')
for f in sorted(res):
@@ -4793,7 +4796,7 @@
ctx = scmutil.revsingle(repo, node)
mf = ctx.manifest()
ui.pager(b'manifest')
- for f in ctx:
+ for f in ctx.matches(m):
fm.startitem()
fm.context(ctx=ctx)
fl = ctx[f].flags()
To: charlesetc, durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20210923/bd704477/attachment.html>
More information about the Mercurial-patches
mailing list