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 datetime | 10 import datetime |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
252 env = GetNoGitPagerEnv() | 252 env = GetNoGitPagerEnv() |
253 if 'GIT_EXTERNAL_DIFF' in env: | 253 if 'GIT_EXTERNAL_DIFF' in env: |
254 del env['GIT_EXTERNAL_DIFF'] | 254 del env['GIT_EXTERNAL_DIFF'] |
255 | 255 |
256 if find_copies: | 256 if find_copies: |
257 similarity_options = ['--find-copies-harder', '-l100000', | 257 similarity_options = ['--find-copies-harder', '-l100000', |
258 '-C%s' % similarity] | 258 '-C%s' % similarity] |
259 else: | 259 else: |
260 similarity_options = ['-M%s' % similarity] | 260 similarity_options = ['-M%s' % similarity] |
261 | 261 |
262 try: | |
263 stdout = sys.stdout.fileno() | |
Dirk Pranke
2014/05/29 20:31:36
drive-by nit: sys.stdout works fine, you don't nee
szager1
2014/05/29 20:48:04
There is some existing code that replaces sys.stdo
Dirk Pranke
2014/05/29 21:10:47
You lost me, or maybe I'm not understanding someth
| |
264 except AttributeError: | |
265 stdout = None | |
262 return subprocess2.call( | 266 return subprocess2.call( |
263 ['git', | 267 ['git', |
264 'diff', '--no-ext-diff', '--stat'] + similarity_options + args, | 268 'diff', '--no-ext-diff', '--stat'] + similarity_options + args, |
265 env=env) | 269 stdout=stdout, env=env) |
266 | 270 |
267 | 271 |
268 class Settings(object): | 272 class Settings(object): |
269 def __init__(self): | 273 def __init__(self): |
270 self.default_server = None | 274 self.default_server = None |
271 self.cc = None | 275 self.cc = None |
272 self.root = None | 276 self.root = None |
273 self.is_git_svn = None | 277 self.is_git_svn = None |
274 self.svn_branch = None | 278 self.svn_branch = None |
275 self.tree_status_url = None | 279 self.tree_status_url = None |
(...skipping 2324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2600 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 2604 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
2601 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 2605 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
2602 | 2606 |
2603 | 2607 |
2604 if __name__ == '__main__': | 2608 if __name__ == '__main__': |
2605 # These affect sys.stdout so do it outside of main() to simplify mocks in | 2609 # These affect sys.stdout so do it outside of main() to simplify mocks in |
2606 # unit testing. | 2610 # unit testing. |
2607 fix_encoding.fix_encoding() | 2611 fix_encoding.fix_encoding() |
2608 colorama.init() | 2612 colorama.init() |
2609 sys.exit(main(sys.argv[1:])) | 2613 sys.exit(main(sys.argv[1:])) |
OLD | NEW |