Line data Source code
1 : // Copyright (C) 2014 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain 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, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.server.change; 16 : 17 : import com.google.gerrit.entities.BranchNameKey; 18 : import com.google.gerrit.extensions.client.SubmitType; 19 : import org.eclipse.jgit.lib.ObjectId; 20 : import org.eclipse.jgit.lib.Ref; 21 : import org.eclipse.jgit.lib.Repository; 22 : 23 : /** Cache for mergeability of commits into destination branches. */ 24 : public interface MergeabilityCache { 25 0 : class NotImplemented implements MergeabilityCache { 26 : @Override 27 : public boolean get( 28 : ObjectId commit, 29 : Ref intoRef, 30 : SubmitType submitType, 31 : String mergeStrategy, 32 : BranchNameKey dest, 33 : Repository repo) { 34 0 : throw new UnsupportedOperationException("Mergeability checking disabled"); 35 : } 36 : 37 : @Override 38 : public Boolean getIfPresent( 39 : ObjectId commit, Ref intoRef, SubmitType submitType, String mergeStrategy) { 40 0 : throw new UnsupportedOperationException("Mergeability checking disabled"); 41 : } 42 : } 43 : 44 : boolean get( 45 : ObjectId commit, 46 : Ref intoRef, 47 : SubmitType submitType, 48 : String mergeStrategy, 49 : BranchNameKey dest, 50 : Repository repo); 51 : 52 : Boolean getIfPresent(ObjectId commit, Ref intoRef, SubmitType submitType, String mergeStrategy); 53 : }