Skip to content

Commit

Permalink
FEATURE: Indicate if a rebase had conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Dec 18, 2024
1 parent 3c87ba5 commit 2d44baa
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ Feature: Rebasing with no conflict
| rebaseErrorHandlingStrategy | "force" |
Then I expect the content stream "user-cs-identifier" to not exist

Then I expect exactly 2 events to be published on stream with prefix "Workspace:user-test"
And event at index 1 is of type "WorkspaceWasRebased" with payload:
| Key | Expected |
| workspaceName | "user-test" |
| newContentStreamId | "user-cs-rebased" |
| previousContentStreamId | "user-cs-identifier" |
| hadConflicts | false |

When I am in workspace "user-test" and dimension space point {}
Then I expect node aggregate identifier "sir-david-nodenborough" to lead to node user-cs-rebased;sir-david-nodenborough;{}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,14 @@ Feature: Workspace rebasing - conflicting changes
| rebasedContentStreamId | "user-cs-identifier-rebased" |
| rebaseErrorHandlingStrategy | "force" |

Then I expect exactly 2 events to be published on stream with prefix "Workspace:user-ws"
And event at index 1 is of type "WorkspaceWasRebased" with payload:
| Key | Expected |
| workspaceName | "user-ws" |
| newContentStreamId | "user-cs-identifier-rebased" |
| previousContentStreamId | "user-cs-identifier" |
| hadConflicts | true |

Then I expect the content stream "user-cs-identifier" to not exist
Then I expect the content stream "user-cs-identifier-rebased" to exist

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ private function rebaseWorkspaceWithoutChanges(
$workspace->workspaceName,
$newContentStreamId,
$workspace->currentContentStreamId,
hadConflicts: false
),
),
ExpectedVersion::ANY()
Expand Down Expand Up @@ -404,6 +405,7 @@ static function ($handle) use ($rebaseableCommands): void {
$command->workspaceName,
$command->rebasedContentStreamId,
$workspace->currentContentStreamId,
hadConflicts: $commandSimulator->hasConflicts()
),
),
ExpectedVersion::ANY()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

use Neos\ContentRepository\Core\EventStore\EventInterface;
use Neos\ContentRepository\Core\Feature\Common\EmbedsWorkspaceName;
use Neos\ContentRepository\Core\Feature\WorkspaceRebase\Dto\RebaseErrorHandlingStrategy;
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId;
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;

Expand All @@ -34,6 +35,10 @@ public function __construct(
* The old content stream ID (which is not active anymore now)
*/
public ContentStreamId $previousContentStreamId,
/**
* Indicates if all events in the workspace were kept or if failing changes were discarded {@see RebaseErrorHandlingStrategy::STRATEGY_FORCE}
*/
public bool $hadConflicts
) {
}

Expand All @@ -48,6 +53,7 @@ public static function fromArray(array $values): self
WorkspaceName::fromString($values['workspaceName']),
ContentStreamId::fromString($values['newContentStreamId']),
ContentStreamId::fromString($values['previousContentStreamId']),
$values['hadConflicts'] ?? false
);
}

Expand Down

0 comments on commit 2d44baa

Please sign in to comment.