Skip to content

Commit

Permalink
Rename ConflictResolution.IGNORE -> ADD
Browse files Browse the repository at this point in the history
  • Loading branch information
snazy committed Apr 25, 2023
1 parent f7bd884 commit 30bdf51
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ private static boolean handleConflict(
conflicts.add(conflict);
// Do not the conflicting action to the commit, report the conflict
return true;
case IGNORE:
case ADD:
// Add the conflicting action to the resulting commit, not reporting as a conflict
return false;
case DROP:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ enum ConflictResolution {
/** Raise the conflict as is. */
CONFLICT,
/** Ignore the conflict, add action to the commit. */
IGNORE,
ADD,
/** Ignore the conflict, do not add the action to the commit. */
DROP
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import static org.projectnessie.versioned.storage.common.logic.CommitConflict.commitConflict;
import static org.projectnessie.versioned.storage.common.logic.ConflictHandler.ConflictResolution.CONFLICT;
import static org.projectnessie.versioned.storage.common.logic.ConflictHandler.ConflictResolution.DROP;
import static org.projectnessie.versioned.storage.common.logic.ConflictHandler.ConflictResolution.IGNORE;
import static org.projectnessie.versioned.storage.common.logic.CreateCommit.Add.commitAdd;
import static org.projectnessie.versioned.storage.common.logic.CreateCommit.Remove.commitRemove;
import static org.projectnessie.versioned.storage.common.logic.CreateCommit.Unchanged.commitUnchanged;
Expand Down Expand Up @@ -560,7 +559,7 @@ public void commitConflictCallbackKeyDoesNotExist() throws Exception {
.build(),
c -> {
conflicts.add(c);
return IGNORE;
return ConflictHandler.ConflictResolution.ADD;
},
callbacks::put);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import static java.util.UUID.randomUUID;
import static org.assertj.core.api.InstanceOfAssertFactories.BOOLEAN;
import static org.projectnessie.versioned.storage.common.indexes.StoreKey.key;
import static org.projectnessie.versioned.storage.common.logic.ConflictHandler.ConflictResolution.ADD;
import static org.projectnessie.versioned.storage.common.logic.ConflictHandler.ConflictResolution.CONFLICT;
import static org.projectnessie.versioned.storage.common.logic.ConflictHandler.ConflictResolution.IGNORE;
import static org.projectnessie.versioned.storage.common.logic.CreateCommit.Add.commitAdd;
import static org.projectnessie.versioned.storage.common.logic.CreateCommit.Remove.commitRemove;
import static org.projectnessie.versioned.storage.common.logic.Logics.commitLogic;
Expand Down Expand Up @@ -89,7 +89,7 @@ public void hashesDifferChecks(List<Consumer<CreateCommit.Builder>> modifiers) t

modifier.accept(commit);

CommitObj c2 = commitLogic.buildCommitObj(commit.build(), c -> IGNORE, (k, id) -> {});
CommitObj c2 = commitLogic.buildCommitObj(commit.build(), c -> ADD, (k, id) -> {});
soft.assertThat(c2)
.describedAs("modified commit: %s", c2)
.isNotNull()
Expand Down Expand Up @@ -134,7 +134,7 @@ public void hashesDoNotDifferChecks(List<Consumer<CreateCommit.Builder>> modifie

modifier.accept(commit);

CommitObj c2 = commitLogic.buildCommitObj(commit.build(), c -> IGNORE, (k, id) -> {});
CommitObj c2 = commitLogic.buildCommitObj(commit.build(), c -> ADD, (k, id) -> {});
soft.assertThat(c2)
.describedAs("modified commit: %s", c2)
.isNotNull()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ CommitObj createMergeTransplantCommit(
&& ex != null
&& op.payload() == ex.payload()
&& contentTypeForPayload((byte) op.payload()) == NAMESPACE) {
return ConflictResolution.IGNORE;
return ConflictResolution.ADD;
}
}
MergeKeyBehavior mergeKeyBehavior = mergeBehaviorForKey.apply(key);
Expand All @@ -578,18 +578,18 @@ && contentTypeForPayload((byte) op.payload()) == NAMESPACE) {
switch (mergeBehavior) {
case NORMAL:
keyDetailsMap.put(key, keyDetails(mergeBehavior, ConflictType.UNRESOLVABLE));
return ConflictResolution.IGNORE;
return ConflictResolution.ADD;
case FORCE:
keyDetailsMap.put(key, keyDetails(mergeBehavior, ConflictType.NONE));
return ConflictResolution.IGNORE;
return ConflictResolution.ADD;
case DROP:
keyDetailsMap.put(key, keyDetails(mergeBehavior, ConflictType.NONE));
return ConflictResolution.DROP;
default:
throw new IllegalStateException("Unknown merge behavior " + mergeBehavior);
}
}
return ConflictResolution.IGNORE;
return ConflictResolution.ADD;
},
(k, v) -> {
ContentKey key = storeKeyToKey(k);
Expand Down

0 comments on commit 30bdf51

Please sign in to comment.