blob: a7d42be12be988bad0bb44a179c9b2061a3239c1 [file] [log] [blame]
James E. Blair45de61c2017-02-14 13:23:14 -08001# Copyright 2012 Hewlett-Packard Development Company, L.P.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15import logging
16from zuul.source import BaseSource
James E. Blair0a899752017-03-29 13:22:16 -070017from zuul.model import Project
James E. Blair45de61c2017-02-14 13:23:14 -080018
19
20class GitSource(BaseSource):
21 name = 'git'
22 log = logging.getLogger("zuul.source.Git")
23
James E. Blair1c774422017-03-28 16:16:34 -070024 def __init__(self, driver, connection, config=None):
25 hostname = connection.canonical_hostname
26 super(GitSource, self).__init__(driver, connection,
27 hostname, config)
28
James E. Blair45de61c2017-02-14 13:23:14 -080029 def getRefSha(self, project, ref):
30 raise NotImplemented()
31
32 def isMerged(self, change, head=None):
33 raise NotImplemented()
34
35 def canMerge(self, change, allow_needs):
36 raise NotImplemented()
37
38 def getChange(self, event, refresh=False):
Fabien Boucher194a2bf2017-12-02 18:17:58 +010039 return self.connection.getChange(event, refresh)
James E. Blair45de61c2017-02-14 13:23:14 -080040
James E. Blair0e4c7912018-01-02 14:20:17 -080041 def getChangeByURL(self, url):
42 return None
43
44 def getChangesDependingOn(self, change, projects):
45 return []
46
47 def getCachedChanges(self):
48 return []
49
James E. Blair45de61c2017-02-14 13:23:14 -080050 def getProject(self, name):
James E. Blair0a899752017-03-29 13:22:16 -070051 p = self.connection.getProject(name)
52 if not p:
53 p = Project(name, self)
54 self.connection.addProject(p)
55 return p
James E. Blair45de61c2017-02-14 13:23:14 -080056
Tobias Henkeleca46202017-08-02 20:27:10 +020057 def getProjectBranches(self, project, tenant):
58 return self.connection.getProjectBranches(project, tenant)
James E. Blair45de61c2017-02-14 13:23:14 -080059
60 def getGitUrl(self, project):
61 return self.connection.getGitUrl(project)
62
63 def getProjectOpenChanges(self, project):
64 raise NotImplemented()
James E. Blairaad3ae22017-05-18 14:11:29 -070065
66 def getRequireFilters(self, config):
67 return []
68
69 def getRejectFilters(self, config):
70 return []