| 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 find_owners |
| 37 | 37 |
| 38 DEFAULT_SERVER = 'https://codereview.appspot.com' | 38 DEFAULT_SERVER = 'https://codereview.appspot.com' |
| 39 POSTUPSTREAM_HOOK_PATTERN = '.git/hooks/post-cl-%s' | 39 POSTUPSTREAM_HOOK_PATTERN = '.git/hooks/post-cl-%s' |
| 40 DESCRIPTION_BACKUP_FILE = '~/.git_cl_description_backup' | 40 DESCRIPTION_BACKUP_FILE = '~/.git_cl_description_backup' |
| 41 GIT_INSTRUCTIONS_URL = 'http://code.google.com/p/chromium/wiki/UsingNewGit' | 41 GIT_INSTRUCTIONS_URL = 'http://code.google.com/p/chromium/wiki/UsingNewGit' |
| 42 CHANGE_ID = 'Change-Id:' | 42 CHANGE_ID = 'Change-Id:' |
| 43 | 43 |
| 44 | 44 |
| 45 # Initialized in main() | 45 # Initialized in main() |
| 46 settings = None | 46 settings = None |
| (...skipping 1763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1810 """close the issue""" | 1810 """close the issue""" |
| 1811 _, args = parser.parse_args(args) | 1811 _, args = parser.parse_args(args) |
| 1812 if args: | 1812 if args: |
| 1813 parser.error('Unrecognized args: %s' % ' '.join(args)) | 1813 parser.error('Unrecognized args: %s' % ' '.join(args)) |
| 1814 cl = Changelist() | 1814 cl = Changelist() |
| 1815 # Ensure there actually is an issue to close. | 1815 # Ensure there actually is an issue to close. |
| 1816 cl.GetDescription() | 1816 cl.GetDescription() |
| 1817 cl.CloseIssue() | 1817 cl.CloseIssue() |
| 1818 return 0 | 1818 return 0 |
| 1819 | 1819 |
| 1820 def CMDowners(parser, args): |
| 1821 """Interactively find the owners for reviewing""" |
| 1822 group = optparse.OptionGroup(parser, "Find owners options") |
| 1823 group.add_option( |
| 1824 "--no-color", dest="ncolor", default=False, |
| 1825 action="store_true", |
| 1826 help=("Use this option to disable color output")) |
| 1827 parser.add_option_group(group) |
| 1828 opt, args = parser.parse_args(args) |
| 1829 cl = Changelist() |
| 1830 |
| 1831 if args: |
| 1832 base_branch = args[0] |
| 1833 else: |
| 1834 # Default to diffing against the common ancestor of the upstream branch. |
| 1835 base_branch = RunGit(['merge-base', cl.GetUpstreamBranch(), 'HEAD']).strip() |
| 1836 |
| 1837 change = cl.GetChange(base_branch, None) |
| 1838 return find_owners.FindOwners( |
| 1839 [f.LocalPath() for f in |
| 1840 cl.GetChange(base_branch, None).AffectedFiles()], |
| 1841 change.RepositoryRoot(), opt.ncolor).run() |
| 1820 | 1842 |
| 1821 def Command(name): | 1843 def Command(name): |
| 1822 return getattr(sys.modules[__name__], 'CMD' + name, None) | 1844 return getattr(sys.modules[__name__], 'CMD' + name, None) |
| 1823 | 1845 |
| 1824 | 1846 |
| 1825 def CMDhelp(parser, args): | 1847 def CMDhelp(parser, args): |
| 1826 """print list of commands or help for a specific command""" | 1848 """print list of commands or help for a specific command""" |
| 1827 _, args = parser.parse_args(args) | 1849 _, args = parser.parse_args(args) |
| 1828 if len(args) == 1: | 1850 if len(args) == 1: |
| 1829 return main(args + ['--help']) | 1851 return main(args + ['--help']) |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1892 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 1914 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
| 1893 | 1915 |
| 1894 # Not a known command. Default to help. | 1916 # Not a known command. Default to help. |
| 1895 GenUsage(parser, 'help') | 1917 GenUsage(parser, 'help') |
| 1896 return CMDhelp(parser, argv) | 1918 return CMDhelp(parser, argv) |
| 1897 | 1919 |
| 1898 | 1920 |
| 1899 if __name__ == '__main__': | 1921 if __name__ == '__main__': |
| 1900 fix_encoding.fix_encoding() | 1922 fix_encoding.fix_encoding() |
| 1901 sys.exit(main(sys.argv[1:])) | 1923 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |