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

Unified Diff: dashboard/dashboard/pinpoint/models/change/patch.py

Issue 3013013002: [pinpoint] Change refactor. (Closed)
Patch Set: UI Created 3 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
Index: dashboard/dashboard/pinpoint/models/change/patch.py
diff --git a/dashboard/dashboard/pinpoint/models/change/patch.py b/dashboard/dashboard/pinpoint/models/change/patch.py
new file mode 100644
index 0000000000000000000000000000000000000000..5907e19eb355fabeb36509e3a75b91ca6a3e58b3
--- /dev/null
+++ b/dashboard/dashboard/pinpoint/models/change/patch.py
@@ -0,0 +1,26 @@
+# Copyright 2016 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.
+
+import collections
+
+
+class Patch(collections.namedtuple('Patch', ('server', 'issue', 'patchset'))):
+ """A patch in Rietveld."""
+ # TODO: Support Gerrit.
+ # https://github.com/catapult-project/catapult/issues/3599
+
+ def __str__(self):
+ return self.id_string
+
+ @property
+ def id_string(self):
+ return '%s/%d/%d' % (self.server, self.issue, self.patchset)
+
+ def AsDict(self):
+ return self._asdict()
+
+ @classmethod
+ def FromDict(cls, data):
+ # TODO: Validate to ensure the patch exists on the server.
+ return cls(data['server'], data['issue'], data['patchset'])

Powered by Google App Engine
This is Rietveld 408576698