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

Side by Side Diff: git_cl.py

Issue 2116493002: Remove old compatibility for git_cl_upload branches. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: More code deletion Created 4 years, 5 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
« 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 and Gerrit.""" 8 """A git-command for integrating reviews on Rietveld and Gerrit."""
9 9
10 from __future__ import print_function 10 from __future__ import print_function
(...skipping 2383 matching lines...) Expand 10 before | Expand all | Expand 10 after
2394 # We assume the remote called "origin" is the one we want. 2394 # We assume the remote called "origin" is the one we want.
2395 # It is probably not worthwhile to support different workflows. 2395 # It is probably not worthwhile to support different workflows.
2396 gerrit_remote = 'origin' 2396 gerrit_remote = 'origin'
2397 2397
2398 remote, remote_branch = self.GetRemoteBranch() 2398 remote, remote_branch = self.GetRemoteBranch()
2399 branch = GetTargetRef(remote, remote_branch, options.target_branch, 2399 branch = GetTargetRef(remote, remote_branch, options.target_branch,
2400 pending_prefix='') 2400 pending_prefix='')
2401 2401
2402 if options.squash: 2402 if options.squash:
2403 self._GerritCommitMsgHookCheck(offer_removal=not options.force) 2403 self._GerritCommitMsgHookCheck(offer_removal=not options.force)
2404 if not self.GetIssue():
2405 # TODO(tandrii): deperecate this after 2016Q2. Backwards compatibility
2406 # with shadow branch, which used to contain change-id for a given
2407 # branch, using which we can fetch actual issue number and set it as the
2408 # property of the branch, which is the new way.
2409 message = RunGitSilent([
2410 'show', '--format=%B', '-s',
2411 'refs/heads/git_cl_uploads/%s' % self.GetBranch()])
2412 if message:
2413 change_ids = git_footers.get_footer_change_id(message.strip())
2414 if change_ids and len(change_ids) == 1:
2415 details = self._GetChangeDetail(issue=change_ids[0])
2416 if details:
2417 print('WARNING: found old upload in branch git_cl_uploads/%s '
2418 'corresponding to issue %s' %
2419 (self.GetBranch(), details['_number']))
2420 self.SetIssue(details['_number'])
2421 if not self.GetIssue():
2422 DieWithError(
2423 '\n' # For readability of the blob below.
2424 'Found old upload in branch git_cl_uploads/%s, '
2425 'but failed to find corresponding Gerrit issue.\n'
2426 'If you know the issue number, set it manually first:\n'
2427 ' git cl issue 123456\n'
2428 'If you intended to upload this CL as new issue, '
2429 'just delete or rename the old upload branch:\n'
2430 ' git rename-branch git_cl_uploads/%s old_upload-%s\n'
2431 'After that, please run git cl upload again.' %
2432 tuple([self.GetBranch()] * 3))
2433 # End of backwards compatability.
2434
2435 if self.GetIssue(): 2404 if self.GetIssue():
2436 # Try to get the message from a previous upload. 2405 # Try to get the message from a previous upload.
2437 message = self.GetDescription() 2406 message = self.GetDescription()
2438 if not message: 2407 if not message:
2439 DieWithError( 2408 DieWithError(
2440 'failed to fetch description from current Gerrit issue %d\n' 2409 'failed to fetch description from current Gerrit issue %d\n'
2441 '%s' % (self.GetIssue(), self.GetIssueURL())) 2410 '%s' % (self.GetIssue(), self.GetIssueURL()))
2442 change_id = self._GetChangeDetail()['change_id'] 2411 change_id = self._GetChangeDetail()['change_id']
2443 while True: 2412 while True:
2444 footer_change_ids = git_footers.get_footer_change_id(message) 2413 footer_change_ids = git_footers.get_footer_change_id(message)
(...skipping 2634 matching lines...) Expand 10 before | Expand all | Expand 10 after
5079 if __name__ == '__main__': 5048 if __name__ == '__main__':
5080 # These affect sys.stdout so do it outside of main() to simplify mocks in 5049 # These affect sys.stdout so do it outside of main() to simplify mocks in
5081 # unit testing. 5050 # unit testing.
5082 fix_encoding.fix_encoding() 5051 fix_encoding.fix_encoding()
5083 setup_color.init() 5052 setup_color.init()
5084 try: 5053 try:
5085 sys.exit(main(sys.argv[1:])) 5054 sys.exit(main(sys.argv[1:]))
5086 except KeyboardInterrupt: 5055 except KeyboardInterrupt:
5087 sys.stderr.write('interrupted\n') 5056 sys.stderr.write('interrupted\n')
5088 sys.exit(1) 5057 sys.exit(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