| 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 difflib | 10 import difflib |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 env=env, | 83 env=env, |
| 84 stdout=subprocess2.PIPE) | 84 stdout=subprocess2.PIPE) |
| 85 return code, out[0] | 85 return code, out[0] |
| 86 except ValueError: | 86 except ValueError: |
| 87 # When the subprocess fails, it returns None. That triggers a ValueError | 87 # When the subprocess fails, it returns None. That triggers a ValueError |
| 88 # when trying to unpack the return value into (out, code). | 88 # when trying to unpack the return value into (out, code). |
| 89 return 1, '' | 89 return 1, '' |
| 90 | 90 |
| 91 | 91 |
| 92 def IsGitVersionAtLeast(min_version): | 92 def IsGitVersionAtLeast(min_version): |
| 93 PREFIX='git version ' | 93 prefix = 'git version ' |
| 94 version = RunGit(['--version']).strip() | 94 version = RunGit(['--version']).strip() |
| 95 return (version.startswith(PREFIX) and | 95 return (version.startswith(prefix) and |
| 96 LooseVersion(version[len(PREFIX):]) >= LooseVersion(min_version)) | 96 LooseVersion(version[len(prefix):]) >= LooseVersion(min_version)) |
| 97 | 97 |
| 98 | 98 |
| 99 def usage(more): | 99 def usage(more): |
| 100 def hook(fn): | 100 def hook(fn): |
| 101 fn.usage_more = more | 101 fn.usage_more = more |
| 102 return fn | 102 return fn |
| 103 return hook | 103 return hook |
| 104 | 104 |
| 105 | 105 |
| 106 def ask_for_data(prompt): | 106 def ask_for_data(prompt): |
| (...skipping 2070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2177 GenUsage(parser, 'help') | 2177 GenUsage(parser, 'help') |
| 2178 return CMDhelp(parser, argv) | 2178 return CMDhelp(parser, argv) |
| 2179 | 2179 |
| 2180 | 2180 |
| 2181 if __name__ == '__main__': | 2181 if __name__ == '__main__': |
| 2182 # These affect sys.stdout so do it outside of main() to simplify mocks in | 2182 # These affect sys.stdout so do it outside of main() to simplify mocks in |
| 2183 # unit testing. | 2183 # unit testing. |
| 2184 fix_encoding.fix_encoding() | 2184 fix_encoding.fix_encoding() |
| 2185 colorama.init() | 2185 colorama.init() |
| 2186 sys.exit(main(sys.argv[1:])) | 2186 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |