| 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'])
|
|
|