Chromium Code Reviews| Index: git_cl.py |
| diff --git a/git_cl.py b/git_cl.py |
| index ce7c6df12595df173b196555d64144ae51bb4493..2ead3dfa475fe49f52e1b0906cb1195f4028021a 100755 |
| --- a/git_cl.py |
| +++ b/git_cl.py |
| @@ -33,6 +33,8 @@ import rietveld |
| import scm |
| import subprocess2 |
| import watchlists |
| +import owners_finder |
| +import glob |
|
M-A Ruel
2013/04/24 13:04:45
this one is a stdlib, move it in the group above.
Bei Zhang
2013/04/24 16:42:01
Done.
|
| DEFAULT_SERVER = 'https://codereview.appspot.com' |
| @@ -1894,6 +1896,35 @@ def CMDset_close(parser, args): |
| return 0 |
| +def CMDowners(parser, args): |
| + """Interactively find the owners for reviewing""" |
|
M-A Ruel
2013/04/24 13:04:45
"""interactively ...
because it's printed as-is i
Bei Zhang
2013/04/24 16:42:01
Done.
|
| + group = optparse.OptionGroup(parser, 'Find owners options') |
| + group.add_option( |
| + '--no-color', |
| + action='store_true', |
| + help=('Use this option to disable color output')) |
|
M-A Ruel
2013/04/24 13:04:45
help='Use this option to disable color output')
Bei Zhang
2013/04/24 16:42:01
Done.
|
| + parser.add_option_group(group) |
| + opt, args = parser.parse_args(args) |
|
M-A Ruel
2013/04/24 13:04:45
please use the same naming conversion than the oth
Bei Zhang
2013/04/24 16:42:01
Done.
|
| + cl = Changelist() |
| + |
| + if args: |
| + if len(args) > 1: |
|
M-A Ruel
2013/04/24 13:04:45
Do this check first, before creating cl.
Bei Zhang
2013/04/24 16:42:01
Done.
|
| + parser.error('Unknown args') |
| + return |
|
M-A Ruel
2013/04/24 13:04:45
not needed, remove. error() calls sys.exit()
Bei Zhang
2013/04/24 16:42:01
Done.
|
| + 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(), |
| + fopen=file, os_path=os.path, glob=glob.glob, |
| + disable_color=opt.no_color).run() |
| + |
| + |
| def Command(name): |
| return getattr(sys.modules[__name__], 'CMD' + name, None) |