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

Unified Diff: verification/committer_revert.py

Issue 23483019: Changes to support One-Click Revert in Commit Queue (Closed) Base URL: https://src.chromium.org/chrome/trunk/tools/commit-queue/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/try_server_test.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: verification/committer_revert.py
===================================================================
--- verification/committer_revert.py (revision 0)
+++ verification/committer_revert.py (revision 0)
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""The revert checkbox must be checked by a project committer."""
+
+
+from verification import base
+
+import re
+
+
+class CommitterRevertStatus(base.SimpleStatus):
+
+ NO_COMMITTER = (
+ 'Revert was not triggered by a project committer. Only full committers\n'
+ 'are accepted.'
+ )
+
+ def __init__(self, pending, committers, **kwargs):
+ super(CommitterRevertStatus, self).__init__(**kwargs)
+ if pending:
+ self._check(pending, committers)
+
+ def _check(self, pending, committers):
+ """Updates self.state and self.error_message properties."""
+ if any(re.match(i, pending.reverted_by) for i in committers):
+ self.state = base.SUCCEEDED
+ else:
+ self.error_message = self.NO_COMMITTER
+ self.state = base.FAILED
+
+
+class CommitterRevertVerifier(base.Verifier):
+ """The revert must be triggered by a project committer."""
+
+ name = 'committer_revert'
+
+ def __init__(self, committers):
+ super(CommitterRevertVerifier, self).__init__()
+ self.committers = committers
+
+ def verify(self, pending):
+ assert pending.revert
+ pending.verifications[self.name] = CommitterRevertStatus(
+ pending=pending, committers=self.committers)
+
+ def update_status(self, queue):
+ pass
Property changes on: verification/committer_revert.py
___________________________________________________________________
Added: svn:executable
+ *
« no previous file with comments | « tests/try_server_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698