LCOV - code coverage report
Current view: top level - extensions/common - CommitInfo.java (source / functions) Hit Total Coverage
Test: _coverage_report.dat Lines: 11 26 42.3 %
Date: 2022-11-19 15:00:39 Functions: 2 5 40.0 %

          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 static java.util.stream.Collectors.joining;
      18             : 
      19             : import com.google.common.base.MoreObjects;
      20             : import com.google.common.base.MoreObjects.ToStringHelper;
      21             : import java.util.List;
      22             : import java.util.Objects;
      23             : 
      24         104 : public class CommitInfo {
      25             :   public String commit;
      26             :   public List<CommitInfo> parents;
      27             :   public GitPerson author;
      28             :   public GitPerson committer;
      29             :   public String subject;
      30             :   public String message;
      31             :   public List<WebLinkInfo> webLinks;
      32             :   public List<WebLinkInfo> resolveConflictsWebLinks;
      33             : 
      34             :   @Override
      35             :   public boolean equals(Object o) {
      36           1 :     if (!(o instanceof CommitInfo)) {
      37           0 :       return false;
      38             :     }
      39           1 :     CommitInfo c = (CommitInfo) o;
      40           1 :     return Objects.equals(commit, c.commit)
      41           1 :         && Objects.equals(parents, c.parents)
      42           1 :         && Objects.equals(author, c.author)
      43           1 :         && Objects.equals(committer, c.committer)
      44           1 :         && Objects.equals(subject, c.subject)
      45           1 :         && Objects.equals(message, c.message)
      46           1 :         && Objects.equals(webLinks, c.webLinks)
      47           1 :         && Objects.equals(resolveConflictsWebLinks, c.resolveConflictsWebLinks);
      48             :   }
      49             : 
      50             :   @Override
      51             :   public int hashCode() {
      52           0 :     return Objects.hash(
      53             :         commit, parents, author, committer, subject, message, webLinks, resolveConflictsWebLinks);
      54             :   }
      55             : 
      56             :   @Override
      57             :   public String toString() {
      58           0 :     ToStringHelper helper = MoreObjects.toStringHelper(this).addValue(commit);
      59           0 :     if (parents != null) {
      60           0 :       helper.add("parents", parents.stream().map(p -> p.commit).collect(joining(", ")));
      61             :     }
      62           0 :     helper
      63           0 :         .add("author", author)
      64           0 :         .add("committer", committer)
      65           0 :         .add("subject", subject)
      66           0 :         .add("message", message);
      67           0 :     if (webLinks != null) {
      68           0 :       helper.add("webLinks", webLinks);
      69             :     }
      70           0 :     if (resolveConflictsWebLinks != null) {
      71           0 :       helper.add("resolveConflictsWebLinks", resolveConflictsWebLinks);
      72             :     }
      73           0 :     return helper.toString();
      74             :   }
      75             : }

Generated by: LCOV version 1.16+git.20220603.dfeb750