OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # Copyright (C) 2008 Evan Martin <martine@danga.com> | 6 # Copyright (C) 2008 Evan Martin <martine@danga.com> |
7 | 7 |
8 """A git-command for integrating reviews on Rietveld.""" | 8 """A git-command for integrating reviews on Rietveld.""" |
9 | 9 |
10 import json | 10 import json |
(...skipping 15 matching lines...) Expand all Loading... | |
26 | 26 |
27 from third_party import upload | 27 from third_party import upload |
28 import breakpad # pylint: disable=W0611 | 28 import breakpad # pylint: disable=W0611 |
29 import fix_encoding | 29 import fix_encoding |
30 import gclient_utils | 30 import gclient_utils |
31 import presubmit_support | 31 import presubmit_support |
32 import rietveld | 32 import rietveld |
33 import scm | 33 import scm |
34 import subprocess2 | 34 import subprocess2 |
35 import watchlists | 35 import watchlists |
36 | 36 import owners_finder |
37 import glob | |
37 | 38 |
M-A Ruel
2013/04/24 01:32:20
another line
Bei Zhang
2013/04/24 03:29:02
Done.
| |
38 DEFAULT_SERVER = 'https://codereview.appspot.com' | 39 DEFAULT_SERVER = 'https://codereview.appspot.com' |
39 POSTUPSTREAM_HOOK_PATTERN = '.git/hooks/post-cl-%s' | 40 POSTUPSTREAM_HOOK_PATTERN = '.git/hooks/post-cl-%s' |
40 DESCRIPTION_BACKUP_FILE = '~/.git_cl_description_backup' | 41 DESCRIPTION_BACKUP_FILE = '~/.git_cl_description_backup' |
41 GIT_INSTRUCTIONS_URL = 'http://code.google.com/p/chromium/wiki/UsingNewGit' | 42 GIT_INSTRUCTIONS_URL = 'http://code.google.com/p/chromium/wiki/UsingNewGit' |
42 CHANGE_ID = 'Change-Id:' | 43 CHANGE_ID = 'Change-Id:' |
43 | 44 |
44 | 45 |
45 # Initialized in main() | 46 # Initialized in main() |
46 settings = None | 47 settings = None |
47 | 48 |
(...skipping 1837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1885 def CMDset_close(parser, args): | 1886 def CMDset_close(parser, args): |
1886 """close the issue""" | 1887 """close the issue""" |
1887 _, args = parser.parse_args(args) | 1888 _, args = parser.parse_args(args) |
1888 if args: | 1889 if args: |
1889 parser.error('Unrecognized args: %s' % ' '.join(args)) | 1890 parser.error('Unrecognized args: %s' % ' '.join(args)) |
1890 cl = Changelist() | 1891 cl = Changelist() |
1891 # Ensure there actually is an issue to close. | 1892 # Ensure there actually is an issue to close. |
1892 cl.GetDescription() | 1893 cl.GetDescription() |
1893 cl.CloseIssue() | 1894 cl.CloseIssue() |
1894 return 0 | 1895 return 0 |
1895 | 1896 |
M-A Ruel
2013/04/24 01:32:20
2 lines
Bei Zhang
2013/04/24 03:29:02
Done.
| |
1897 def CMDowners(parser, args): | |
1898 """Interactively find the owners for reviewing""" | |
1899 group = optparse.OptionGroup(parser, "Find owners options") | |
M-A Ruel
2013/04/24 01:32:20
Use ' instead of "
Bei Zhang
2013/04/24 03:29:02
Done.
| |
1900 group.add_option( | |
1901 "--no-color", dest="ncolor", default=False, | |
M-A Ruel
2013/04/24 01:32:20
no need to default=False
I'd prefer to not use des
Bei Zhang
2013/04/24 03:29:02
Done.
| |
1902 action="store_true", | |
1903 help=("Use this option to disable color output")) | |
1904 parser.add_option_group(group) | |
1905 opt, args = parser.parse_args(args) | |
1906 cl = Changelist() | |
1907 | |
M-A Ruel
2013/04/24 01:32:20
if len(args) > 1:
parser.error('Unknown args
Bei Zhang
2013/04/24 03:29:02
Done.
| |
1908 if args: | |
1909 base_branch = args[0] | |
1910 else: | |
1911 # Default to diffing against the common ancestor of the upstream branch. | |
1912 base_branch = RunGit(['merge-base', cl.GetUpstreamBranch(), 'HEAD']).strip() | |
1913 | |
1914 change = cl.GetChange(base_branch, None) | |
1915 return owners_finder.OwnersFinder( | |
1916 [f.LocalPath() for f in | |
1917 cl.GetChange(base_branch, None).AffectedFiles()], | |
1918 change.RepositoryRoot(), | |
1919 fopen=file, os_path=os.path, glob=glob.glob, | |
1920 disable_color=opt.ncolor).run() | |
1896 | 1921 |
1897 def Command(name): | 1922 def Command(name): |
1898 return getattr(sys.modules[__name__], 'CMD' + name, None) | 1923 return getattr(sys.modules[__name__], 'CMD' + name, None) |
1899 | 1924 |
1900 | 1925 |
1901 def CMDhelp(parser, args): | 1926 def CMDhelp(parser, args): |
1902 """print list of commands or help for a specific command""" | 1927 """print list of commands or help for a specific command""" |
1903 _, args = parser.parse_args(args) | 1928 _, args = parser.parse_args(args) |
1904 if len(args) == 1: | 1929 if len(args) == 1: |
1905 return main(args + ['--help']) | 1930 return main(args + ['--help']) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1968 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 1993 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
1969 | 1994 |
1970 # Not a known command. Default to help. | 1995 # Not a known command. Default to help. |
1971 GenUsage(parser, 'help') | 1996 GenUsage(parser, 'help') |
1972 return CMDhelp(parser, argv) | 1997 return CMDhelp(parser, argv) |
1973 | 1998 |
1974 | 1999 |
1975 if __name__ == '__main__': | 2000 if __name__ == '__main__': |
1976 fix_encoding.fix_encoding() | 2001 fix_encoding.fix_encoding() |
1977 sys.exit(main(sys.argv[1:])) | 2002 sys.exit(main(sys.argv[1:])) |
OLD | NEW |