Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Side by Side Diff: git_cl.py

Issue 10532034: Revert "Turn on git diff copy detection for git-cl upload." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/git_cl_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 json 10 import json
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 if ': ' in line) 1012 if ': ' in line)
1013 remote_url = keys.get('URL', None) 1013 remote_url = keys.get('URL', None)
1014 else: 1014 else:
1015 if cl.GetRemoteUrl() and '/' in cl.GetUpstreamBranch(): 1015 if cl.GetRemoteUrl() and '/' in cl.GetUpstreamBranch():
1016 remote_url = (cl.GetRemoteUrl() + '@' 1016 remote_url = (cl.GetRemoteUrl() + '@'
1017 + cl.GetUpstreamBranch().split('/')[-1]) 1017 + cl.GetUpstreamBranch().split('/')[-1])
1018 if remote_url: 1018 if remote_url:
1019 upload_args.extend(['--base_url', remote_url]) 1019 upload_args.extend(['--base_url', remote_url])
1020 1020
1021 try: 1021 try:
1022 # upload uses '-C' by default when generating the diff for upload. 1022 issue, patchset = upload.RealMain(['upload'] + upload_args + args)
1023 # Add another '-C' to trigger --find-copies-harder.
1024 issue, patchset = upload.RealMain(['upload'] + upload_args + args +
1025 ['--', '-C'])
1026 except KeyboardInterrupt: 1023 except KeyboardInterrupt:
1027 sys.exit(1) 1024 sys.exit(1)
1028 except: 1025 except:
1029 # If we got an exception after the user typed a description for their 1026 # If we got an exception after the user typed a description for their
1030 # change, back up the description before re-raising. 1027 # change, back up the description before re-raising.
1031 if change_desc: 1028 if change_desc:
1032 backup_path = os.path.expanduser(DESCRIPTION_BACKUP_FILE) 1029 backup_path = os.path.expanduser(DESCRIPTION_BACKUP_FILE)
1033 print '\nGot exception while uploading -- saving description to %s\n' \ 1030 print '\nGot exception while uploading -- saving description to %s\n' \
1034 % backup_path 1031 % backup_path
1035 backup_file = open(backup_path, 'w') 1032 backup_file = open(backup_path, 'w')
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 if not options.reviewers and hook_results.reviewers: 1105 if not options.reviewers and hook_results.reviewers:
1109 options.reviewers = hook_results.reviewers 1106 options.reviewers = hook_results.reviewers
1110 1107
1111 # --no-ext-diff is broken in some versions of Git, so try to work around 1108 # --no-ext-diff is broken in some versions of Git, so try to work around
1112 # this by overriding the environment (but there is still a problem if the 1109 # this by overriding the environment (but there is still a problem if the
1113 # git config key "diff.external" is used). 1110 # git config key "diff.external" is used).
1114 env = os.environ.copy() 1111 env = os.environ.copy()
1115 if 'GIT_EXTERNAL_DIFF' in env: 1112 if 'GIT_EXTERNAL_DIFF' in env:
1116 del env['GIT_EXTERNAL_DIFF'] 1113 del env['GIT_EXTERNAL_DIFF']
1117 subprocess2.call( 1114 subprocess2.call(
1118 ['git', 'diff', '--no-ext-diff', '--stat', '-C', '-C'] + args, env=env) 1115 ['git', 'diff', '--no-ext-diff', '--stat', '-M'] + args, env=env)
1119 1116
1120 if settings.GetIsGerrit(): 1117 if settings.GetIsGerrit():
1121 return GerritUpload(options, args, cl) 1118 return GerritUpload(options, args, cl)
1122 return RietveldUpload(options, args, cl) 1119 return RietveldUpload(options, args, cl)
1123 1120
1124 1121
1125 def SendUpstream(parser, args, cmd): 1122 def SendUpstream(parser, args, cmd):
1126 """Common code for CmdPush and CmdDCommit 1123 """Common code for CmdPush and CmdDCommit
1127 1124
1128 Squashed commit into a single. 1125 Squashed commit into a single.
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
1554 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) 1551 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)))
1555 1552
1556 # Not a known command. Default to help. 1553 # Not a known command. Default to help.
1557 GenUsage(parser, 'help') 1554 GenUsage(parser, 'help')
1558 return CMDhelp(parser, argv) 1555 return CMDhelp(parser, argv)
1559 1556
1560 1557
1561 if __name__ == '__main__': 1558 if __name__ == '__main__':
1562 fix_encoding.fix_encoding() 1559 fix_encoding.fix_encoding()
1563 sys.exit(main(sys.argv[1:])) 1560 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | tests/git_cl_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698