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

Side by Side Diff: git_cl.py

Issue 2089683002: Gerrit git cl land: add warning if Commit-Queue label exists. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: review Created 4 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
« no previous file with comments | « no previous file | no next file » | 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 2223 matching lines...) Expand 10 before | Expand all | Expand 10 after
2234 def _GetChangeDetail(self, options=None, issue=None): 2234 def _GetChangeDetail(self, options=None, issue=None):
2235 options = options or [] 2235 options = options or []
2236 issue = issue or self.GetIssue() 2236 issue = issue or self.GetIssue()
2237 assert issue, 'issue required to query Gerrit' 2237 assert issue, 'issue required to query Gerrit'
2238 return gerrit_util.GetChangeDetail(self._GetGerritHost(), str(issue), 2238 return gerrit_util.GetChangeDetail(self._GetGerritHost(), str(issue),
2239 options) 2239 options)
2240 2240
2241 def CMDLand(self, force, bypass_hooks, verbose): 2241 def CMDLand(self, force, bypass_hooks, verbose):
2242 if git_common.is_dirty_git_tree('land'): 2242 if git_common.is_dirty_git_tree('land'):
2243 return 1 2243 return 1
2244 detail = self._GetChangeDetail(['CURRENT_REVISION', 'LABELS'])
2245 if u'Commit-Queue' in detail.get('labels', {}):
2246 if not force:
2247 ask_for_data('\nIt seems this repository has a Commit Queue, '
2248 'which can test and land changes for you. '
2249 'Are you sure you wish to bypass it?\n'
2250 'Press Enter to continue, Ctrl+C to abort.')
2251
2244 differs = True 2252 differs = True
2245 last_upload = RunGit(['config', 2253 last_upload = RunGit(['config',
2246 'branch.%s.gerritsquashhash' % self.GetBranch()], 2254 'branch.%s.gerritsquashhash' % self.GetBranch()],
2247 error_ok=True).strip() 2255 error_ok=True).strip()
2248 # Note: git diff outputs nothing if there is no diff. 2256 # Note: git diff outputs nothing if there is no diff.
2249 if not last_upload or RunGit(['diff', last_upload]).strip(): 2257 if not last_upload or RunGit(['diff', last_upload]).strip():
2250 print('WARNING: some changes from local branch haven\'t been uploaded') 2258 print('WARNING: some changes from local branch haven\'t been uploaded')
2251 else: 2259 else:
2252 detail = self._GetChangeDetail(['CURRENT_REVISION'])
2253 if detail['current_revision'] == last_upload: 2260 if detail['current_revision'] == last_upload:
2254 differs = False 2261 differs = False
2255 else: 2262 else:
2256 print('WARNING: local branch contents differ from latest uploaded ' 2263 print('WARNING: local branch contents differ from latest uploaded '
2257 'patchset') 2264 'patchset')
2258 if differs: 2265 if differs:
2259 if not force: 2266 if not force:
2260 ask_for_data( 2267 ask_for_data(
2261 'Do you want to submit latest Gerrit patchset and bypass hooks?') 2268 'Do you want to submit latest Gerrit patchset and bypass hooks?')
2262 print('WARNING: bypassing hooks and submitting latest uploaded patchset') 2269 print('WARNING: bypassing hooks and submitting latest uploaded patchset')
(...skipping 2779 matching lines...) Expand 10 before | Expand all | Expand 10 after
5042 if __name__ == '__main__': 5049 if __name__ == '__main__':
5043 # These affect sys.stdout so do it outside of main() to simplify mocks in 5050 # These affect sys.stdout so do it outside of main() to simplify mocks in
5044 # unit testing. 5051 # unit testing.
5045 fix_encoding.fix_encoding() 5052 fix_encoding.fix_encoding()
5046 setup_color.init() 5053 setup_color.init()
5047 try: 5054 try:
5048 sys.exit(main(sys.argv[1:])) 5055 sys.exit(main(sys.argv[1:]))
5049 except KeyboardInterrupt: 5056 except KeyboardInterrupt:
5050 sys.stderr.write('interrupted\n') 5057 sys.stderr.write('interrupted\n')
5051 sys.exit(1) 5058 sys.exit(1)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698