OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # git-cl -- a git-command for integrating reviews on Rietveld | 2 # git-cl -- a git-command for integrating reviews on Rietveld |
3 # Copyright (C) 2008 Evan Martin <martine@danga.com> | 3 # Copyright (C) 2008 Evan Martin <martine@danga.com> |
4 | 4 |
5 import errno | 5 import errno |
6 import logging | 6 import logging |
7 import optparse | 7 import optparse |
8 import os | 8 import os |
9 import re | 9 import re |
10 import subprocess | 10 import subprocess |
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 if os.path.isfile(hook): | 1022 if os.path.isfile(hook): |
1023 RunHook(hook, upstream_branch=base_branch, error_ok=True) | 1023 RunHook(hook, upstream_branch=base_branch, error_ok=True) |
1024 | 1024 |
1025 return 0 | 1025 return 0 |
1026 | 1026 |
1027 | 1027 |
1028 @usage('[upstream branch to apply against]') | 1028 @usage('[upstream branch to apply against]') |
1029 def CMDdcommit(parser, args): | 1029 def CMDdcommit(parser, args): |
1030 """commit the current changelist via git-svn""" | 1030 """commit the current changelist via git-svn""" |
1031 if not settings.GetIsGitSvn(): | 1031 if not settings.GetIsGitSvn(): |
1032 print('This doesn\'t appear to be an SVN repository.') | 1032 message = """This doesn't appear to be an SVN repository. |
1033 print('Are you sure you didn\'t mean \'git cl push\'?') | 1033 If your project has a git mirror with an upstream SVN master, you probably need |
| 1034 to run 'git svn init', see your project's git mirror documentation. |
| 1035 If your project has a true writeable upstream repository, you probably want |
| 1036 to run 'git cl push' instead. |
| 1037 Choose wisely, if you get this wrong, your commit might appear to succeed but |
| 1038 will instead be silently ignored.""" |
| 1039 print(message) |
1034 raw_input('[Press enter to dcommit or ctrl-C to quit]') | 1040 raw_input('[Press enter to dcommit or ctrl-C to quit]') |
1035 return SendUpstream(parser, args, 'dcommit') | 1041 return SendUpstream(parser, args, 'dcommit') |
1036 | 1042 |
1037 | 1043 |
1038 @usage('[upstream branch to apply against]') | 1044 @usage('[upstream branch to apply against]') |
1039 def CMDpush(parser, args): | 1045 def CMDpush(parser, args): |
1040 """commit the current changelist via git""" | 1046 """commit the current changelist via git""" |
1041 if settings.GetIsGitSvn(): | 1047 if settings.GetIsGitSvn(): |
1042 print('This appears to be an SVN repository.') | 1048 print('This appears to be an SVN repository.') |
1043 print('Are you sure you didn\'t mean \'git cl dcommit\'?') | 1049 print('Are you sure you didn\'t mean \'git cl dcommit\'?') |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 1267 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
1262 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 1268 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
1263 | 1269 |
1264 # Not a known command. Default to help. | 1270 # Not a known command. Default to help. |
1265 GenUsage(parser, 'help') | 1271 GenUsage(parser, 'help') |
1266 return CMDhelp(parser, argv) | 1272 return CMDhelp(parser, argv) |
1267 | 1273 |
1268 | 1274 |
1269 if __name__ == '__main__': | 1275 if __name__ == '__main__': |
1270 sys.exit(main(sys.argv[1:])) | 1276 sys.exit(main(sys.argv[1:])) |
OLD | NEW |