OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 logging | 10 import logging |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 DESCRIPTION_BACKUP_FILE = '~/.git_cl_description_backup' | 48 DESCRIPTION_BACKUP_FILE = '~/.git_cl_description_backup' |
49 | 49 |
50 | 50 |
51 def DieWithError(message): | 51 def DieWithError(message): |
52 print >> sys.stderr, message | 52 print >> sys.stderr, message |
53 sys.exit(1) | 53 sys.exit(1) |
54 | 54 |
55 | 55 |
56 def RunCommand(args, error_ok=False, error_message=None, **kwargs): | 56 def RunCommand(args, error_ok=False, error_message=None, **kwargs): |
57 try: | 57 try: |
58 return subprocess2.check_output(args, **kwargs) | 58 return subprocess2.check_output(args, shell=False, **kwargs) |
59 except subprocess2.CalledProcessError, e: | 59 except subprocess2.CalledProcessError, e: |
60 if not error_ok: | 60 if not error_ok: |
61 DieWithError( | 61 DieWithError( |
62 'Command "%s" failed.\n%s' % ( | 62 'Command "%s" failed.\n%s' % ( |
63 ' '.join(args), error_message or e.stdout or '')) | 63 ' '.join(args), error_message or e.stdout or '')) |
64 return e.stdout | 64 return e.stdout |
65 | 65 |
66 | 66 |
67 def RunGit(args, **kwargs): | 67 def RunGit(args, **kwargs): |
68 """Returns stdout.""" | 68 """Returns stdout.""" |
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1430 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 1430 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
1431 | 1431 |
1432 # Not a known command. Default to help. | 1432 # Not a known command. Default to help. |
1433 GenUsage(parser, 'help') | 1433 GenUsage(parser, 'help') |
1434 return CMDhelp(parser, argv) | 1434 return CMDhelp(parser, argv) |
1435 | 1435 |
1436 | 1436 |
1437 if __name__ == '__main__': | 1437 if __name__ == '__main__': |
1438 fix_encoding.fix_encoding() | 1438 fix_encoding.fix_encoding() |
1439 sys.exit(main(sys.argv[1:])) | 1439 sys.exit(main(sys.argv[1:])) |
OLD | NEW |