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 from distutils.version import LooseVersion | 10 from distutils.version import LooseVersion |
(...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1597 'chmod +x .git/hooks/commit-msg' % (dst, src)) | 1597 'chmod +x .git/hooks/commit-msg' % (dst, src)) |
1598 os.chmod(dst, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR) | 1598 os.chmod(dst, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR) |
1599 except Exception: | 1599 except Exception: |
1600 if os.path.exists(dst): | 1600 if os.path.exists(dst): |
1601 os.remove(dst) | 1601 os.remove(dst) |
1602 DieWithError('\nFailed to download hooks.\n' | 1602 DieWithError('\nFailed to download hooks.\n' |
1603 'You need to download from\n%s\n' | 1603 'You need to download from\n%s\n' |
1604 'into .git/hooks/commit-msg and ' | 1604 'into .git/hooks/commit-msg and ' |
1605 'chmod +x .git/hooks/commit-msg' % src) | 1605 'chmod +x .git/hooks/commit-msg' % src) |
1606 | 1606 |
| 1607 # TODO(tandrii): remove this once repos which call this method directly are |
| 1608 # upgraded. |
| 1609 DownloadHooks = DownloadGerritHook |
1607 | 1610 |
1608 @subcommand.usage('[repo root containing codereview.settings]') | 1611 @subcommand.usage('[repo root containing codereview.settings]') |
1609 def CMDconfig(parser, args): | 1612 def CMDconfig(parser, args): |
1610 """Edits configuration for this tree.""" | 1613 """Edits configuration for this tree.""" |
1611 | 1614 |
1612 parser.add_option('--activate-update', action='store_true', | 1615 parser.add_option('--activate-update', action='store_true', |
1613 help='activate auto-updating [rietveld] section in ' | 1616 help='activate auto-updating [rietveld] section in ' |
1614 '.git/config') | 1617 '.git/config') |
1615 parser.add_option('--deactivate-update', action='store_true', | 1618 parser.add_option('--deactivate-update', action='store_true', |
1616 help='deactivate auto-updating [rietveld] section in ' | 1619 help='deactivate auto-updating [rietveld] section in ' |
(...skipping 2368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3985 if __name__ == '__main__': | 3988 if __name__ == '__main__': |
3986 # These affect sys.stdout so do it outside of main() to simplify mocks in | 3989 # These affect sys.stdout so do it outside of main() to simplify mocks in |
3987 # unit testing. | 3990 # unit testing. |
3988 fix_encoding.fix_encoding() | 3991 fix_encoding.fix_encoding() |
3989 colorama.init() | 3992 colorama.init() |
3990 try: | 3993 try: |
3991 sys.exit(main(sys.argv[1:])) | 3994 sys.exit(main(sys.argv[1:])) |
3992 except KeyboardInterrupt: | 3995 except KeyboardInterrupt: |
3993 sys.stderr.write('interrupted\n') | 3996 sys.stderr.write('interrupted\n') |
3994 sys.exit(1) | 3997 sys.exit(1) |
OLD | NEW |