Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: tools/git/for-all-touched-files.py

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/clang/scripts/update.sh ('k') | tools/git/move_source_file.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/git/for-all-touched-files.py
diff --git a/tools/git/for-all-touched-files.py b/tools/git/for-all-touched-files.py
index a7e784ade3e1920ede69a20fdb597b89e7080f15..633fd078cdad4bcf5e8ac7e2b8ec8921b39383a1 100755
--- a/tools/git/for-all-touched-files.py
+++ b/tools/git/for-all-touched-files.py
@@ -13,11 +13,12 @@
Deleted files are not included. Neither are untracked files.
Synopsis:
- %prog [-b BRANCH] [-d] [-x EXTENSIONS|-c] [-t TOKEN] QUOTED_COMMAND
+ %prog [-b BRANCH] [-d] [-x EXTENSIONS|-c|-g] [-t TOKEN] QUOTED_COMMAND
Examples:
%prog -x gyp,gypi "tools/format_xml.py [[FILENAME]]"
%prog -c "tools/sort-headers.py [[FILENAME]]"
+ %prog -g "tools/sort_sources.py [[FILENAME]]"
%prog -t "~~BINGO~~" "echo I modified ~~BINGO~~"
"""
@@ -29,6 +30,8 @@ import sys
# List of C++-like source file extensions.
_CPP_EXTENSIONS = ('h', 'hh', 'hpp', 'c', 'cc', 'cpp', 'cxx', 'mm',)
+# List of build file extensions.
+_BUILD_EXTENSIONS = ('gyp', 'gypi', 'gn',)
def GitShell(args, ignore_return=False):
@@ -91,6 +94,10 @@ def main():
parser.add_option('-c', '--cpp', default=False, action='store_true',
dest='cpp_only',
help='Runs your command only on C++-like source files.')
+ # -g stands for GYP and GN.
+ parser.add_option('-g', '--build', default=False, action='store_true',
+ dest='build_only',
+ help='Runs your command only on build files.')
parser.add_option('-t', '--token', default='[[FILENAME]]', dest='token',
help='Sets the token to be replaced for each file '
'in your command (default [[FILENAME]]).')
@@ -103,9 +110,14 @@ def main():
parser.print_help()
sys.exit(1)
+ if opts.cpp_only and opts.build_only:
+ parser.error("--cpp and --build are mutually exclusive")
+
extensions = opts.extensions
if opts.cpp_only:
extensions = _CPP_EXTENSIONS
+ if opts.build_only:
+ extensions = _BUILD_EXTENSIONS
ForAllTouchedFiles(opts.branch, extensions, opts.token, args[0])
« no previous file with comments | « tools/clang/scripts/update.sh ('k') | tools/git/move_source_file.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698