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 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 log_args = [args[0][:-1]] | 1046 log_args = [args[0][:-1]] |
1047 elif len(args) == 2: | 1047 elif len(args) == 2: |
1048 log_args = [args[0] + '..' + args[1]] | 1048 log_args = [args[0] + '..' + args[1]] |
1049 else: | 1049 else: |
1050 log_args = args[:] # Hope for the best! | 1050 log_args = args[:] # Hope for the best! |
1051 return RunGit(['log', '--pretty=format:%s\n\n%b'] + log_args) | 1051 return RunGit(['log', '--pretty=format:%s\n\n%b'] + log_args) |
1052 | 1052 |
1053 | 1053 |
1054 def CMDpresubmit(parser, args): | 1054 def CMDpresubmit(parser, args): |
1055 """run presubmit tests on the current changelist""" | 1055 """run presubmit tests on the current changelist""" |
1056 parser.add_option('--upload', action='store_true', | 1056 parser.add_option('-u', '--upload', action='store_true', |
1057 help='Run upload hook instead of the push/dcommit hook') | 1057 help='Run upload hook instead of the push/dcommit hook') |
1058 parser.add_option('--force', action='store_true', | 1058 parser.add_option('-f', '--force', action='store_true', |
1059 help='Run checks even if tree is dirty') | 1059 help='Run checks even if tree is dirty') |
1060 (options, args) = parser.parse_args(args) | 1060 (options, args) = parser.parse_args(args) |
1061 | 1061 |
1062 if not options.force and is_dirty_git_tree('presubmit'): | 1062 if not options.force and is_dirty_git_tree('presubmit'): |
1063 print 'use --force to check even if tree is dirty.' | 1063 print 'use --force to check even if tree is dirty.' |
1064 return 1 | 1064 return 1 |
1065 | 1065 |
1066 cl = Changelist() | 1066 cl = Changelist() |
1067 if args: | 1067 if args: |
1068 base_branch = args[0] | 1068 base_branch = args[0] |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1866 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 1866 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
1867 | 1867 |
1868 # Not a known command. Default to help. | 1868 # Not a known command. Default to help. |
1869 GenUsage(parser, 'help') | 1869 GenUsage(parser, 'help') |
1870 return CMDhelp(parser, argv) | 1870 return CMDhelp(parser, argv) |
1871 | 1871 |
1872 | 1872 |
1873 if __name__ == '__main__': | 1873 if __name__ == '__main__': |
1874 fix_encoding.fix_encoding() | 1874 fix_encoding.fix_encoding() |
1875 sys.exit(main(sys.argv[1:])) | 1875 sys.exit(main(sys.argv[1:])) |
OLD | NEW |