Chromium Code Reviews

Unified Diff: rietveld.py

Issue 24095007: GTTF: Add ReadOnlyRietveld similar to one currently in CQ codebase. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: rietveld.py
diff --git a/rietveld.py b/rietveld.py
index e412a28046b377fc7c9a79b619a5dda7f08a56b1..b085c17812e7a8243067be719edac85c3a7d6c1e 100644
--- a/rietveld.py
+++ b/rietveld.py
@@ -445,3 +445,40 @@ class CachingRietveld(Rietveld):
'get_patchset_properties',
(issue, patchset),
super(CachingRietveld, self).get_patchset_properties)
+
+
+class ReadOnlyRietveld(Rietveld):
Isaac (away) 2013/09/14 07:48:08 I think maybe this should not extend rietveld -- t
Paweł Hajdan Jr. 2013/09/16 14:33:52 Sounds good to me - I'll probably do that on Thurs
M-A Ruel 2013/09/16 14:53:05 Technically, you could just zap POST and be fine.
+ """Only provides read operations, and simulates writes locally."""
+
+ # Dictionary of local changes, indexed by issue number as int.
+ _local_changes = {}
+
+ def __init__(self, *args, **kwargs):
+ super(ReadOnlyRietveld, self).__init__(*args, **kwargs)
+
+ def close_issue(self, issue):
+ logging.info('ReadOnlyRietveld: closing issue %d' % issue)
+ ReadOnlyRietveld._local_changes.setdefault(issue, {})['closed'] = True
+
+ def get_issue_properties(self, issue, messages):
+ data = super(ReadOnlyRietveld, self).get_issue_properties(issue, messages)
+ data.update(ReadOnlyRietveld._local_changes.get(issue, {}))
+ return data
+
+ def update_description(self, issue, description):
+ logging.info('ReadOnlyRietveld: new description for issue %d: %s' %
+ (issue, description))
+
+ def add_comment(self, issue, message, add_as_reviewer=False):
+ logging.info('ReadOnlyRietveld: posting comment "%s" to issue %d' %
+ (message, issue))
+
+ def set_flag(self, issue, patchset, flag, value):
+ logging.info('ReadOnlyRietveld: setting flag "%s" to "%s" for issue %d' %
+ (flag, value, issue))
+ ReadOnlyRietveld._local_changes.setdefault(issue, {})[flag] = value
+
+ def trigger_try_jobs(
+ self, issue, patchset, reason, clobber, revision, builders_and_tests):
+ logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' %
+ (builders_and_tests, issue))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine