Skip to content

Commit

Permalink
Remove unused sourceHashes from TransplantResult (#9628)
Browse files Browse the repository at this point in the history
This attribute is not returned to clients and never read/used elsewhere.
  • Loading branch information
snazy authored Sep 26, 2024
1 parent 9799364 commit 082f420
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ public void transplant() {
TransplantResult result =
TransplantResult.builder()
.sourceRef(BranchName.of("branch1"))
.sourceHashes(List.of(Hash.of("11111111"), Hash.of("22222222"), Hash.of("33333333")))
.targetBranch(BranchName.of("branch2"))
.effectiveTargetHash(Hash.of("567890ab"))
.resultantTargetHash(Hash.of("90abcedf"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.security.Principal;
import java.time.Clock;
import java.time.Instant;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
Expand Down Expand Up @@ -161,7 +160,6 @@ void newTransplantEvent(Principal user, String expectedInitiator) {
TransplantResult result =
TransplantResult.builder()
.sourceRef(BranchName.of("branch1"))
.sourceHashes(List.of(Hash.of("11111111"), Hash.of("22222222"), Hash.of("33333333")))
.targetBranch(BranchName.of("branch2"))
.effectiveTargetHash(Hash.of("cafebabe")) // hash before
.resultantTargetHash(Hash.of("deadbeef")) // hash after
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import java.time.Instant;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -162,7 +161,6 @@ private Stream<Result> allResults() {
.build(),
TransplantResult.builder()
.sourceRef(BranchName.of("branch1"))
.sourceHashes(List.of(Hash.of("11111111"), Hash.of("22222222"), Hash.of("33333333")))
.targetBranch(BranchName.of("branch2"))
.effectiveTargetHash(Hash.of("cafebabe")) // hash before
.resultantTargetHash(Hash.of("deadbeef")) // hash after
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package org.projectnessie.versioned;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.List;
import org.immutables.value.Value;

@Value.Immutable
Expand All @@ -27,17 +25,11 @@ default ResultType getResultType() {
return ResultType.TRANSPLANT;
}

List<Hash> getSourceHashes();

static TransplantResult.Builder builder() {
return ImmutableTransplantResult.builder();
}

interface Builder extends MergeTransplantResultBase.Builder<TransplantResult, Builder> {

@CanIgnoreReturnValue
Builder sourceHashes(Iterable<? extends Hash> hashes);

TransplantResult build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ public TransplantResult transplant(Optional<?> retryState, TransplantOp transpla
TransplantResult.builder()
.targetBranch(branch)
.effectiveTargetHash(objIdToHash(headId()))
.sourceRef(transplantOp.fromRef())
.sourceHashes(transplantOp.sequenceToTransplant());
.sourceRef(transplantOp.fromRef());

referenceHash.ifPresent(transplantResult::expectedHash);

Expand Down

0 comments on commit 082f420

Please sign in to comment.