Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: refactoring introducing a single generic strategy #324

Merged
merged 8 commits into from
Apr 26, 2024

Conversation

Maximilien-R
Copy link
Contributor

The goal of this PR is to refactor the implementation of the strategies to move from an interface with an implementation dedicated to each strategy to a generic strategy whose behaviour is defined according to its options.

This refactoring should reduces the code duplication and ease maintenance and the addition of new feature.

Note: I tried to create unit commits to make it easier to review pull request commit by commit.

Replaces the Strategy interface and its dedicated implementations for a generic strategy to pool logic and reduce code duplication.
Adds the Repository field to switchBranchOptions for reuse in switchBranch and ease access to repository information such as full name.
Forwards the Repository struct to commitChanges to ease access to repository information such as full name.
Updates the signature of the commiChanges function to take an approach using an opts parameter with a dedicated commitOptions struct to be consistent with the signatures of other similar
functions.
Adds the Repository field to pushOptions for reuse in pushChanges and ease access to repository information such as full name.
@Maximilien-R Maximilien-R requested review from vbehar and a team as code owners April 24, 2024 10:49
Adds the implementation of a CommitMessage struct dedicated to handling commit messages with the separation between the headline and the body.
Moves the creation of the commit message directly into the pull request strategy and forward it into commit options.
Replaces the ForcePush and ForceBranchCreation strategy options with ResetFromBase to make the strategy implementation more readable.
@Maximilien-R Maximilien-R merged commit 5eefa96 into dailymotion-oss:master Apr 26, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants