Chromium Code Reviews| Index: git_cl.py |
| diff --git a/git_cl.py b/git_cl.py |
| index db9823042e62a91a1e8258e007cc5a90380c162b..92809723d564ffca042de3ecc118388c966427be 100755 |
| --- a/git_cl.py |
| +++ b/git_cl.py |
| @@ -19,6 +19,7 @@ import sys |
| import textwrap |
| import urllib2 |
| import urlparse |
| +import glob |
| try: |
| import readline # pylint: disable=F0401,W0611 |
| @@ -36,6 +37,7 @@ import rietveld |
| import scm |
| import subprocess2 |
| import watchlists |
| +import owners_finder |
| DEFAULT_SERVER = 'https://codereview.appspot.com' |
| @@ -1999,6 +2001,35 @@ def CMDset_close(parser, args): |
| return 0 |
| +def CMDowners(parser, args): |
| + """interactively find the owners for reviewing""" |
| + group = optparse.OptionGroup(parser, 'Find owners options') |
| + group.add_option( |
| + '--no-color', |
| + action='store_true', |
| + help='Use this option to disable color output') |
| + parser.add_option_group(group) |
|
Dirk Pranke
2013/07/27 00:06:03
I probably wouldn't use an OptionGroup for this, j
Bei Zhang
2013/07/30 05:59:17
Done.
|
| + options, args = parser.parse_args(args) |
| + |
| + if args: |
| + if len(args) > 1: |
| + parser.error('Unknown args') |
| + cl = Changelist() |
| + base_branch = args[0] |
| + else: |
| + cl = Changelist() |
| + # 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(), |
| + fopen=file, os_path=os.path, glob=glob.glob, |
| + disable_color=options.no_color).run() |
| + |
| + |
| def CMDformat(parser, args): |
| """run clang-format on the diff""" |
| CLANG_EXTS = ['.cc', '.cpp', '.h'] |