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

Side by Side Diff: rietveld.py

Issue 1149653002: [depot_tools] Find, upload and apply patchset dependencies (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Upload dependencies even if closed Created 5 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
« git_cl.py ('K') | « git_cl.py ('k') | third_party/upload.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 # coding: utf-8 1 # coding: utf-8
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 """Defines class Rietveld to easily access a rietveld instance. 5 """Defines class Rietveld to easily access a rietveld instance.
6 6
7 Security implications: 7 Security implications:
8 8
9 The following hypothesis are made: 9 The following hypothesis are made:
10 - Rietveld enforces: 10 - Rietveld enforces:
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 def get_issue_properties(self, issue, messages): 78 def get_issue_properties(self, issue, messages):
79 """Returns all the issue's metadata as a dictionary.""" 79 """Returns all the issue's metadata as a dictionary."""
80 url = '/api/%d' % issue 80 url = '/api/%d' % issue
81 if messages: 81 if messages:
82 url += '?messages=true' 82 url += '?messages=true'
83 data = json.loads(self.get(url, retry_on_404=True)) 83 data = json.loads(self.get(url, retry_on_404=True))
84 data['description'] = '\n'.join(data['description'].strip().splitlines()) 84 data['description'] = '\n'.join(data['description'].strip().splitlines())
85 return data 85 return data
86 86
87 def get_depends_on_patchset(self, issue, patchset):
88 """Returns the patchset this patchset depends on if it exists."""
89 url = '/%d/patchset/%d/get_depends_on_patchset' % (issue, patchset)
90 resp = None
91 try:
92 resp = self.get(url)
93 except urllib2.HTTPError, e:
94 # The get_depends_on_patchset endpoint does not exist on this Rietveld
agable 2015/06/08 20:05:53 Add a TODO to make this a real error eventually?
rmistry 2015/06/09 16:16:45 Done.
95 # instance yet. Ignore the error and proceed.
96 pass
97 return resp
98
87 def get_patchset_properties(self, issue, patchset): 99 def get_patchset_properties(self, issue, patchset):
88 """Returns the patchset properties.""" 100 """Returns the patchset properties."""
89 url = '/api/%d/%d' % (issue, patchset) 101 url = '/api/%d/%d' % (issue, patchset)
90 return json.loads(self.get(url)) 102 return json.loads(self.get(url))
91 103
92 def get_file_content(self, issue, patchset, item): 104 def get_file_content(self, issue, patchset, item):
93 """Returns the content of a new file. 105 """Returns the content of a new file.
94 106
95 Throws HTTP 302 exception if the file doesn't exist or is not a binary file. 107 Throws HTTP 302 exception if the file doesn't exist or is not a binary file.
96 """ 108 """
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 ReadOnlyRietveld._local_changes.setdefault(issue, {})['closed'] = True 680 ReadOnlyRietveld._local_changes.setdefault(issue, {})['closed'] = True
669 681
670 def get_issue_properties(self, issue, messages): 682 def get_issue_properties(self, issue, messages):
671 data = self._rietveld.get_issue_properties(issue, messages) 683 data = self._rietveld.get_issue_properties(issue, messages)
672 data.update(self._get_local_changes(issue)) 684 data.update(self._get_local_changes(issue))
673 return data 685 return data
674 686
675 def get_patchset_properties(self, issue, patchset): 687 def get_patchset_properties(self, issue, patchset):
676 return self._rietveld.get_patchset_properties(issue, patchset) 688 return self._rietveld.get_patchset_properties(issue, patchset)
677 689
690 def get_depends_on_patchset(self, issue, patchset):
691 return self._rietveld.get_depends_on_patchset(issue, patchset)
692
678 def get_patch(self, issue, patchset): 693 def get_patch(self, issue, patchset):
679 return self._rietveld.get_patch(issue, patchset) 694 return self._rietveld.get_patch(issue, patchset)
680 695
681 def update_description(self, issue, description): # pylint:disable=R0201 696 def update_description(self, issue, description): # pylint:disable=R0201
682 logging.info('ReadOnlyRietveld: new description for issue %d: %s' % 697 logging.info('ReadOnlyRietveld: new description for issue %d: %s' %
683 (issue, description)) 698 (issue, description))
684 699
685 def add_comment(self, # pylint:disable=R0201 700 def add_comment(self, # pylint:disable=R0201
686 issue, 701 issue,
687 message, 702 message,
(...skipping 10 matching lines...) Expand all
698 self, issue, patchset, reason, clobber, revision, builders_and_tests, 713 self, issue, patchset, reason, clobber, revision, builders_and_tests,
699 master=None, category='cq'): 714 master=None, category='cq'):
700 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % 715 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' %
701 (builders_and_tests, issue)) 716 (builders_and_tests, issue))
702 717
703 def trigger_distributed_try_jobs( # pylint:disable=R0201 718 def trigger_distributed_try_jobs( # pylint:disable=R0201
704 self, issue, patchset, reason, clobber, revision, masters, 719 self, issue, patchset, reason, clobber, revision, masters,
705 category='cq'): 720 category='cq'):
706 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % 721 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' %
707 (masters, issue)) 722 (masters, issue))
OLDNEW
« git_cl.py ('K') | « git_cl.py ('k') | third_party/upload.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698