James E. Blair | 45de61c | 2017-02-14 13:23:14 -0800 | [diff] [blame] | 1 | # 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 | |
| 15 | import logging |
| 16 | from zuul.source import BaseSource |
James E. Blair | 0a89975 | 2017-03-29 13:22:16 -0700 | [diff] [blame] | 17 | from zuul.model import Project |
James E. Blair | 45de61c | 2017-02-14 13:23:14 -0800 | [diff] [blame] | 18 | |
| 19 | |
| 20 | class GitSource(BaseSource): |
| 21 | name = 'git' |
| 22 | log = logging.getLogger("zuul.source.Git") |
| 23 | |
James E. Blair | 1c77442 | 2017-03-28 16:16:34 -0700 | [diff] [blame] | 24 | 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. Blair | 45de61c | 2017-02-14 13:23:14 -0800 | [diff] [blame] | 29 | 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 Boucher | 194a2bf | 2017-12-02 18:17:58 +0100 | [diff] [blame] | 39 | return self.connection.getChange(event, refresh) |
James E. Blair | 45de61c | 2017-02-14 13:23:14 -0800 | [diff] [blame] | 40 | |
James E. Blair | 0e4c791 | 2018-01-02 14:20:17 -0800 | [diff] [blame] | 41 | 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. Blair | 45de61c | 2017-02-14 13:23:14 -0800 | [diff] [blame] | 50 | def getProject(self, name): |
James E. Blair | 0a89975 | 2017-03-29 13:22:16 -0700 | [diff] [blame] | 51 | p = self.connection.getProject(name) |
| 52 | if not p: |
| 53 | p = Project(name, self) |
| 54 | self.connection.addProject(p) |
| 55 | return p |
James E. Blair | 45de61c | 2017-02-14 13:23:14 -0800 | [diff] [blame] | 56 | |
Tobias Henkel | eca4620 | 2017-08-02 20:27:10 +0200 | [diff] [blame] | 57 | def getProjectBranches(self, project, tenant): |
| 58 | return self.connection.getProjectBranches(project, tenant) |
James E. Blair | 45de61c | 2017-02-14 13:23:14 -0800 | [diff] [blame] | 59 | |
| 60 | def getGitUrl(self, project): |
| 61 | return self.connection.getGitUrl(project) |
| 62 | |
| 63 | def getProjectOpenChanges(self, project): |
| 64 | raise NotImplemented() |
James E. Blair | aad3ae2 | 2017-05-18 14:11:29 -0700 | [diff] [blame] | 65 | |
| 66 | def getRequireFilters(self, config): |
| 67 | return [] |
| 68 | |
| 69 | def getRejectFilters(self, config): |
| 70 | return [] |