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.extensions.common; 16 : 17 : import java.util.List; 18 : 19 : /* This entity contains information about the diff of a file in a revision. */ 20 10 : public class DiffInfo { 21 : // Meta information about the file on side A 22 : public FileMeta metaA; 23 : // Meta information about the file on side B 24 : public FileMeta metaB; 25 : // Intraline status 26 : public IntraLineStatus intralineStatus; 27 : // The type of change 28 : public ChangeType changeType; 29 : // A list of strings representing the patch set diff header 30 : public List<String> diffHeader; 31 : // The content differences in the file as a list of entities 32 : public List<ContentEntry> content; 33 : // Links to the file diff in external sites 34 : public List<DiffWebLinkInfo> webLinks; 35 : // Links to edit the file in external sites 36 : public List<WebLinkInfo> editWebLinks; 37 : // Binary file 38 : public Boolean binary; 39 : 40 5 : public enum IntraLineStatus { 41 5 : OK, 42 5 : TIMEOUT, 43 5 : FAILURE 44 : } 45 : 46 10 : public static class FileMeta { 47 : // The ID of the commit containing the file 48 : public transient String commitId; 49 : // The name of the file 50 : public String name; 51 : // The content type of the file 52 : public String contentType; 53 : // The total number of lines in the file 54 : public Integer lines; 55 : // Links to the file in external sites 56 : public List<WebLinkInfo> webLinks; 57 : } 58 : 59 10 : public static final class ContentEntry { 60 : // Common lines to both sides. 61 : public List<String> ab; 62 : // Lines of a. 63 : public List<String> a; 64 : // Lines of b. 65 : public List<String> b; 66 : 67 : // A list of changed sections of the corresponding line list. 68 : // Each entry is a character <offset, length> pair. The offset is from the 69 : // beginning of the first line in the list. Also, the offset includes an 70 : // implied trailing newline character for each line. 71 : public List<List<Integer>> editA; 72 : public List<List<Integer>> editB; 73 : 74 : // Indicates that this entry only exists because of a rebase (and not because of a real change 75 : // between 'a' and 'b'). 76 : public Boolean dueToRebase; 77 : 78 : // a and b are actually common with this whitespace ignore setting. 79 : public Boolean common; 80 : 81 : // Number of lines to skip on both sides. 82 : public Integer skip; 83 : } 84 : }