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

Side by Side Diff: git_cl.py

Issue 2280563003: Fix Gerrit git cl land and add test. (Closed)
Patch Set: Fix code and finish test. Created 4 years, 3 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 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after
2299 return 1 2299 return 1
2300 detail = self._GetChangeDetail(['CURRENT_REVISION', 'LABELS']) 2300 detail = self._GetChangeDetail(['CURRENT_REVISION', 'LABELS'])
2301 if u'Commit-Queue' in detail.get('labels', {}): 2301 if u'Commit-Queue' in detail.get('labels', {}):
2302 if not force: 2302 if not force:
2303 ask_for_data('\nIt seems this repository has a Commit Queue, ' 2303 ask_for_data('\nIt seems this repository has a Commit Queue, '
2304 'which can test and land changes for you. ' 2304 'which can test and land changes for you. '
2305 'Are you sure you wish to bypass it?\n' 2305 'Are you sure you wish to bypass it?\n'
2306 'Press Enter to continue, Ctrl+C to abort.') 2306 'Press Enter to continue, Ctrl+C to abort.')
2307 2307
2308 differs = True 2308 differs = True
2309 last_upload = RunGit(['config', self._GitBranchSetting('gerritsquashhash')], 2309 last_upload = self._GitGetBranchConfigValue('gerritsquashhash')
2310 error_ok=True).strip()
2311 # Note: git diff outputs nothing if there is no diff. 2310 # Note: git diff outputs nothing if there is no diff.
2312 if not last_upload or RunGit(['diff', last_upload]).strip(): 2311 if not last_upload or RunGit(['diff', last_upload]).strip():
2313 print('WARNING: some changes from local branch haven\'t been uploaded') 2312 print('WARNING: some changes from local branch haven\'t been uploaded')
2314 else: 2313 else:
2315 if detail['current_revision'] == last_upload: 2314 if detail['current_revision'] == last_upload:
2316 differs = False 2315 differs = False
2317 else: 2316 else:
2318 print('WARNING: local branch contents differ from latest uploaded ' 2317 print('WARNING: local branch contents differ from latest uploaded '
2319 'patchset') 2318 'patchset')
2320 if differs: 2319 if differs:
(...skipping 2896 matching lines...) Expand 10 before | Expand all | Expand 10 after
5217 if __name__ == '__main__': 5216 if __name__ == '__main__':
5218 # These affect sys.stdout so do it outside of main() to simplify mocks in 5217 # These affect sys.stdout so do it outside of main() to simplify mocks in
5219 # unit testing. 5218 # unit testing.
5220 fix_encoding.fix_encoding() 5219 fix_encoding.fix_encoding()
5221 setup_color.init() 5220 setup_color.init()
5222 try: 5221 try:
5223 sys.exit(main(sys.argv[1:])) 5222 sys.exit(main(sys.argv[1:]))
5224 except KeyboardInterrupt: 5223 except KeyboardInterrupt:
5225 sys.stderr.write('interrupted\n') 5224 sys.stderr.write('interrupted\n')
5226 sys.exit(1) 5225 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