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.edit; 16 : 17 : import static java.util.Objects.requireNonNull; 18 : 19 : import com.google.gerrit.entities.Change; 20 : import com.google.gerrit.entities.PatchSet; 21 : import org.eclipse.jgit.revwalk.RevCommit; 22 : 23 : /** 24 : * A single user's edit for a change. 25 : * 26 : * <p>There is max. one edit per user per change. Edits are stored on refs: 27 : * refs/users/UU/UUUU/edit-CCCC/P where UU/UUUU is sharded representation of user account, CCCC is 28 : * change number and P is the patch set number it is based on. 29 : */ 30 : public class ChangeEdit { 31 : private final Change change; 32 : private final String editRefName; 33 : private final RevCommit editCommit; 34 : private final PatchSet basePatchSet; 35 : 36 : public ChangeEdit( 37 27 : Change change, String editRefName, RevCommit editCommit, PatchSet basePatchSet) { 38 27 : this.change = requireNonNull(change); 39 27 : this.editRefName = requireNonNull(editRefName); 40 27 : this.editCommit = requireNonNull(editCommit); 41 27 : this.basePatchSet = requireNonNull(basePatchSet); 42 27 : } 43 : 44 : public Change getChange() { 45 21 : return change; 46 : } 47 : 48 : public String getRefName() { 49 24 : return editRefName; 50 : } 51 : 52 : public RevCommit getEditCommit() { 53 25 : return editCommit; 54 : } 55 : 56 : public PatchSet getBasePatchSet() { 57 24 : return basePatchSet; 58 : } 59 : }