| 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 and Gerrit.""" | 8 """A git-command for integrating reviews on Rietveld and Gerrit.""" |
| 9 | 9 |
| 10 from distutils.version import LooseVersion | 10 from distutils.version import LooseVersion |
| (...skipping 2110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2121 with open(destination, 'w') as f: | 2121 with open(destination, 'w') as f: |
| 2122 f.write(urllib2.urlopen(source).read()) | 2122 f.write(urllib2.urlopen(source).read()) |
| 2123 | 2123 |
| 2124 | 2124 |
| 2125 def hasSheBang(fname): | 2125 def hasSheBang(fname): |
| 2126 """Checks fname is a #! script.""" | 2126 """Checks fname is a #! script.""" |
| 2127 with open(fname) as f: | 2127 with open(fname) as f: |
| 2128 return f.read(2).startswith('#!') | 2128 return f.read(2).startswith('#!') |
| 2129 | 2129 |
| 2130 | 2130 |
| 2131 # TODO(bpastene) Remove once a cleaner fix to crbug.com/600473 presents itself. |
| 2132 def DownloadHooks(*args, **kwargs): |
| 2133 pass |
| 2134 |
| 2135 |
| 2131 def DownloadGerritHook(force): | 2136 def DownloadGerritHook(force): |
| 2132 """Download and install Gerrit commit-msg hook. | 2137 """Download and install Gerrit commit-msg hook. |
| 2133 | 2138 |
| 2134 Args: | 2139 Args: |
| 2135 force: True to update hooks. False to install hooks if not present. | 2140 force: True to update hooks. False to install hooks if not present. |
| 2136 """ | 2141 """ |
| 2137 if not settings.GetIsGerrit(): | 2142 if not settings.GetIsGerrit(): |
| 2138 return | 2143 return |
| 2139 src = 'https://gerrit-review.googlesource.com/tools/hooks/commit-msg' | 2144 src = 'https://gerrit-review.googlesource.com/tools/hooks/commit-msg' |
| 2140 dst = os.path.join(settings.GetRoot(), '.git', 'hooks', 'commit-msg') | 2145 dst = os.path.join(settings.GetRoot(), '.git', 'hooks', 'commit-msg') |
| (...skipping 2474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4615 if __name__ == '__main__': | 4620 if __name__ == '__main__': |
| 4616 # These affect sys.stdout so do it outside of main() to simplify mocks in | 4621 # These affect sys.stdout so do it outside of main() to simplify mocks in |
| 4617 # unit testing. | 4622 # unit testing. |
| 4618 fix_encoding.fix_encoding() | 4623 fix_encoding.fix_encoding() |
| 4619 setup_color.init() | 4624 setup_color.init() |
| 4620 try: | 4625 try: |
| 4621 sys.exit(main(sys.argv[1:])) | 4626 sys.exit(main(sys.argv[1:])) |
| 4622 except KeyboardInterrupt: | 4627 except KeyboardInterrupt: |
| 4623 sys.stderr.write('interrupted\n') | 4628 sys.stderr.write('interrupted\n') |
| 4624 sys.exit(1) | 4629 sys.exit(1) |
| OLD | NEW |