]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9816 Transitively find long-lived branch to use as target
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Mon, 2 Oct 2017 13:05:51 +0000 (15:05 +0200)
committerDuarte Meneses <duarte.meneses@sonarsource.com>
Mon, 2 Oct 2017 14:21:29 +0000 (16:21 +0200)
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchInfo.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectBranches.java

index 508d8d1ddfef9095ed576c5cb03186682ecf3b4e..3031ffd65d32231246e115d5af54512bb74fc651 100644 (file)
@@ -19,6 +19,8 @@
  */
 package org.sonar.scanner.scan.branch;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nullable;
 import javax.annotation.concurrent.Immutable;
 
 /**
@@ -29,11 +31,19 @@ public class BranchInfo {
   private final String name;
   private final BranchType type;
   private final boolean isMain;
+  @Nullable
+  private final String branchTargetName;
 
-  public BranchInfo(String name, BranchType type, boolean isMain) {
+  public BranchInfo(String name, BranchType type, boolean isMain, @Nullable String branchTargetName) {
     this.name = name;
     this.type = type;
     this.isMain = isMain;
+    this.branchTargetName = branchTargetName;
+  }
+
+  @CheckForNull
+  public String branchTargetName() {
+    return branchTargetName;
   }
 
   public String name() {
index 697ab5dbaf46e421f226cab35114c04062207cde..00cd3965ec05808c7d572bed7a3178b727826bf7 100644 (file)
@@ -23,6 +23,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.function.Function;
 import java.util.stream.Collectors;
+import javax.annotation.CheckForNull;
 import javax.annotation.concurrent.Immutable;
 
 /**
@@ -37,6 +38,7 @@ public class ProjectBranches {
     branches = branchInfos.stream().collect(Collectors.toMap(BranchInfo::name, Function.identity()));
   }
 
+  @CheckForNull
   public BranchInfo get(String name) {
     return branches.get(name);
   }