-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
Rework PR/MR feature #219
Rework PR/MR feature #219
Conversation
24d4e68
to
c384448
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit starts the refactoring of PR/MR feature code. It provides a more readable code by: - renaming method #manage for GitHub and GitLab class to open_pull_request - extracting the credentials and endpoints to use in only one method: GitService#instantiate It also provides a more understandable messages: - `msync` does not warn anymore if no environmment variables are sets, but correctly configured in module options - when no tokens are provided, the message now only contains the service that requires to specify token Note: This message could be improved to help the user to setup its modules configuration or ask him to set the environment variable.
This commit renames ModuleSync::PR module to ModuleSync::GitService. Git service classes (ie. GitHub and GitLab) can now be used to implement more features than PR/MR opening. (e.g voxpupuli#158)
This commit only changes notation to ease code review, it does not change any code.
This commit only changes notation to ease further context introduction, it does not change any code.
This commit adds a check to ensure no PR/MR are made with the same source and target branch. This commit implements a facade class (ie. GitService::Base) to prevent adding duplicate code in the git services and remove any global options[] usage. It lets SourceCode#open_pull_request to craft the right parameters to pass to the GitService once, so it deduplicates the code in specialised service. By design, this allows to honor easily the default repo branch.
Thanks to previous commit, this commit fixes voxpupuli#207 and now honors the default repo branch.
This commit removes the outputs like "Would submit PR" when there are no changes after update (in no-op mode).
At this point, GitService should guess "git service" type (ie. GitHub or GitLab) and rely on multiple sources to do. As there is no more default (ie. which was GitHub) and the local git repo used does not provide guessable service type, we need to add this `base_url` options on each tests before
This commit implements a method to know which Git service (ie. GitHub or GitLab) is used to host source code. * introduces a specific error when creadentials are missing * adds method to guess git service type based on a SourceCode instance * adds method to find with git service's endpoint should be used * adds method to find token * adds a method to pack a configuration hash (type, endpoint, token) based on a SourceCode instance
This commit adds support for more repository notations and provides unit tests.
c384448
to
ce795d5
Compare
Codecov Report
@@ Coverage Diff @@
## master #219 +/- ##
==========================================
- Coverage 52.35% 6.02% -46.33%
==========================================
Files 14 17 +3
Lines 510 846 +336
==========================================
- Hits 267 51 -216
- Misses 243 795 +552
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of stuff, not easy for a review, but overall LGTM!
I spotted a bug, and will fix it tomorrow. |
@smortex @bastelfreak @bittner : Its ready to review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a quick look through the code and in general it looks good to me. It's pretty large so I may have missed things.
3ec550c
to
3abdb32
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor thing
3abdb32
to
57ebbb4
Compare
I think it's good enough to be merged now |
👍 |
This one is bigger than previous ones... even I tried to fine split.
I worked in TDD, so I started with tests, then made some progress, saw that my work will affect more than expected, wrote more tests, continue with a light refactoring and finally rework all PR/MR as a generic
GitService
.The hardest part on this topic is to "implement" all unspecified behavior, so I tried to extend the test coverage.
I tried to keep the backward compatibility, but some specific corner cases could fail.
At this point, I made my best to prevent from breaking compatibility but I think some fundamentals should be re-written to make sense.
Nevertheless this rewrite allow us to easily fix some issues later, and provide a generic way to use "git service", which can be reuse for other features (e.g. #158).