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

Side by Side Diff: apply_issue.py

Issue 11024009: Fix private issues, take two. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 years, 2 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 | 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 """Applies an issue from Rietveld. 6 """Applies an issue from Rietveld.
7 """ 7 """
8 8
9 import getpass 9 import getpass
10 import logging 10 import logging
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 except urllib2.HTTPError, e: 80 except urllib2.HTTPError, e:
81 if e.getcode() != 302: 81 if e.getcode() != 302:
82 raise 82 raise
83 # TODO(maruel): A few 'Invalid username or password.' are printed first, we 83 # TODO(maruel): A few 'Invalid username or password.' are printed first, we
84 # should get rid of those. 84 # should get rid of those.
85 except rietveld.upload.ClientLoginError, e: 85 except rietveld.upload.ClientLoginError, e:
86 # Fine, we'll do proper authentication. 86 # Fine, we'll do proper authentication.
87 pass 87 pass
88 if properties is None: 88 if properties is None:
89 if options.email is not None: 89 if options.email is not None:
90 obj = rietveld.Rietveld(options.server, options.email, options.password)
90 try: 91 try:
91 obj = rietveld.Rietveld(options.server, options.email, options.password) 92 properties = obj.get_issue_properties(options.issue, False)
92 except rietveld.upload.ClientLoginError, e: 93 except rietveld.upload.ClientLoginError, e:
93 if sys.stdout.closed: 94 if sys.stdout.closed:
94 print('Accessing the issue requires proper credentials.') 95 print('Accessing the issue requires proper credentials.')
95 return 1 96 return 1
96 print('Accessing the issue requires login.') 97 else:
97 obj = rietveld.Rietveld(options.server, None, None) 98 print('Accessing the issue requires login.')
98 properties = obj.get_issue_properties(options.issue, False) 99 obj = rietveld.Rietveld(options.server, None, None)
100 try:
101 properties = obj.get_issue_properties(options.issue, False)
102 except rietveld.upload.ClientLoginError, e:
103 print('Accessing the issue requires proper credentials.')
104 return 1
99 105
100 if not options.patchset: 106 if not options.patchset:
101 options.patchset = properties['patchsets'][-1] 107 options.patchset = properties['patchsets'][-1]
102 print('No patchset specified. Using patchset %d' % options.patchset) 108 print('No patchset specified. Using patchset %d' % options.patchset)
103 109
104 print('Downloading the patch.') 110 print('Downloading the patch.')
105 try: 111 try:
106 patchset = obj.get_patch(options.issue, options.patchset) 112 patchset = obj.get_patch(options.issue, options.patchset)
107 except urllib2.HTTPError, e: 113 except urllib2.HTTPError, e:
108 print( 114 print(
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 if sys.platform == 'win32': 159 if sys.platform == 'win32':
154 gclient_path += '.bat' 160 gclient_path += '.bat'
155 return subprocess.call( 161 return subprocess.call(
156 [gclient_path, 'sync', '--revision', base_rev], cwd=gclient_root) 162 [gclient_path, 'sync', '--revision', base_rev], cwd=gclient_root)
157 return 0 163 return 0
158 164
159 165
160 if __name__ == "__main__": 166 if __name__ == "__main__":
161 fix_encoding.fix_encoding() 167 fix_encoding.fix_encoding()
162 sys.exit(main()) 168 sys.exit(main())
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