| Index: appengine/findit/waterfall/suspected_cl_util.py
|
| diff --git a/appengine/findit/waterfall/suspected_cl_util.py b/appengine/findit/waterfall/suspected_cl_util.py
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c77e5d5aa95462ad6f289441f4a3ed76dd08d2ec
|
| --- /dev/null
|
| +++ b/appengine/findit/waterfall/suspected_cl_util.py
|
| @@ -0,0 +1,31 @@
|
| +# 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.
|
| +
|
| +from google.appengine.ext import ndb
|
| +
|
| +from model import analysis_approach_type
|
| +from model.wf_suspected_cl import WfSuspectedCL
|
| +
|
| +
|
| +@ndb.transactional
|
| +def UpdateSuspectedCL(
|
| + approach, master_name, builder_name, build_number, failure_type,
|
| + repo_name, revision, commit_position):
|
| +
|
| + suspected_cl = (
|
| + WfSuspectedCL.Get(repo_name, revision) or
|
| + WfSuspectedCL.Create(repo_name, revision, commit_position))
|
| +
|
| + if suspected_cl.approach is None:
|
| + suspected_cl.approach = approach
|
| + elif suspected_cl.approach != approach:
|
| + suspected_cl.approach = analysis_approach_type.BOTH
|
| +
|
| + suspected_cl.failure_type = suspected_cl.failure_type or failure_type
|
| +
|
| + build_info = [master_name, builder_name, build_number]
|
| + if build_info not in suspected_cl.builds:
|
| + suspected_cl.builds.append(build_info)
|
| +
|
| + suspected_cl.put()
|
|
|