Line data Source code
1 : // Copyright (C) 2020 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.patch.filediff; 16 : 17 : import com.google.auto.value.AutoValue; 18 : import java.util.Optional; 19 : import org.eclipse.jgit.lib.ObjectId; 20 : 21 : /** 22 : * A wrapper entity to the {@link FileDiffCacheKey} that also includes the old parent commit ID, the 23 : * new parent commit ID and if we should ignore computing the rebase edits for that key. 24 : */ 25 : @AutoValue 26 93 : abstract class AugmentedFileDiffCacheKey { 27 : abstract FileDiffCacheKey key(); 28 : 29 : abstract boolean ignoreRebase(); 30 : 31 : abstract Optional<ObjectId> oldParentId(); 32 : 33 : abstract Optional<ObjectId> newParentId(); 34 : 35 : static Builder builder() { 36 93 : return new AutoValue_AugmentedFileDiffCacheKey.Builder(); 37 : } 38 : 39 : @AutoValue.Builder 40 93 : public abstract static class Builder { 41 : 42 : public abstract Builder oldParentId(Optional<ObjectId> value); 43 : 44 : public abstract Builder newParentId(Optional<ObjectId> value); 45 : 46 : public abstract Builder ignoreRebase(boolean value); 47 : 48 : public abstract Builder key(FileDiffCacheKey value); 49 : 50 : public abstract AugmentedFileDiffCacheKey build(); 51 : } 52 : }