Krinkle has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/349352 )
Change subject: mwgrep: Add --etitle option
......................................................................
mwgrep: Add --etitle option
This allow users to override the default '.*\.(js|css)' pattern
with a custom pattern. Especially useful when looking for subpages
only with '.*\.js/' for 'Foo.js/en'. Or for anything for both
the main message and its translations (e.g. 'Cite ref error.*'
to match btoh 'Cite ref error' and 'Cite ref error/nl'.
Change-Id: Ie567a52c610b06c33a65ee62ed7b2eb35a061ca4
---
M modules/scap/files/mwgrep
1 file changed, 11 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/52/349352/1
diff --git a/modules/scap/files/mwgrep b/modules/scap/files/mwgrep
index 65f4f05..ebc4872 100755
--- a/modules/scap/files/mwgrep
+++ b/modules/scap/files/mwgrep
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
"""
usage: mwgrep [-h] [--max-results N] [--timeout N] [--user | --module]
- [--title TITLE] regex
+ [--title TITLE] [--etitle regex] regex
Grep for Lua or CSS and JS code fragments on (per default) MediaWiki wiki
pages
@@ -15,7 +15,8 @@
--timeout N abort search after this many seconds (default: 30)
--user search NS_USER rather than NS_MEDIAWIKI
--module search NS_MODULE rather than NS_MEDIAWIKI
- --title TITLE restrict search to pages with this title
+ --title TITLE restrict search to pages with this exact title
+ --etitle regex restrict search to pages with this title pattern
mwgrep will grep the MediaWiki namespace across Wikimedia wikis. specify
--user to search the user namespace instead. See the lucene documentation
@@ -71,7 +72,12 @@
ap.add_argument(
'--title',
- help='Restrict search to pages with this title (sans namespace)'
+ help='Restrict search to pages with this exact title (sans namespace)'
+)
+
+ap.add_argument(
+ '--etitle',
+ help='Restrict search to pages with this title pattern (sans namespace)'
)
ns_group = ap.add_mutually_exclusive_group()
@@ -112,6 +118,8 @@
if args.title is not None:
filters.append( {'term': {'title.keyword': args.title}} )
+elif args.etitle is not None:
+ filters.append( {'regexp': {'title.keyword': args.etitle}} )
elif args.ns == NS_USER or args.ns == NS_MEDIAWIKI:
filters.append( {'regexp': {'title.keyword': '.*\\.(js|css)'}} )
--
To view, visit https://gerrit.wikimedia.org/r/349352
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie567a52c610b06c33a65ee62ed7b2eb35a061ca4
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Krinkle <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits