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

Unified Diff: git_cl.py

Issue 12712002: An interactive tool to help find owners covering current change list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Fix nits Created 7 years, 3 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 | « no previous file | owners.py » ('j') | owners_finder.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl.py
diff --git a/git_cl.py b/git_cl.py
index 43c9d365bd93c3a0d1dabe1d2d6372fd8a8a297d..289640a77cc0b1962faf9dc8c50abaabe8bd4f35 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -8,6 +8,7 @@
"""A git-command for integrating reviews on Rietveld."""
from distutils.version import LooseVersion
+import glob
import json
import logging
import optparse
@@ -38,6 +39,7 @@ import scm
import subcommand
import subprocess2
import watchlists
+import owners_finder
__version__ = '1.0'
@@ -2126,6 +2128,35 @@ def CMDset_close(parser, args):
return 0
+def CMDowners(parser, args):
+ """interactively find the owners for reviewing"""
+ parser.add_option(
+ '--no-color',
+ action='store_true',
+ help='Use this option to disable color output')
+ options, args = parser.parse_args(args)
+
+ author = RunGit(['config', 'user.email']).strip() or None
+
+ cl = Changelist()
+
+ if args:
+ if len(args) > 1:
+ parser.error('Unknown args')
+ base_branch = args[0]
+ else:
+ # Default to diffing against the common ancestor of the upstream branch.
+ base_branch = RunGit(['merge-base', cl.GetUpstreamBranch(), 'HEAD']).strip()
+
+ change = cl.GetChange(base_branch, None)
+ return owners_finder.OwnersFinder(
+ [f.LocalPath() for f in
+ cl.GetChange(base_branch, None).AffectedFiles()],
+ change.RepositoryRoot(), author,
+ fopen=file, os_path=os.path, glob=glob.glob,
+ disable_color=options.no_color).run()
+
+
def CMDformat(parser, args):
"""Runs clang-format on the diff."""
CLANG_EXTS = ['.cc', '.cpp', '.h']
« no previous file with comments | « no previous file | owners.py » ('j') | owners_finder.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698