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

The default branch "master" is now configurable #308

Closed
wants to merge 4 commits into from

Conversation

Adysone
Copy link

@Adysone Adysone commented Apr 10, 2019

Creates a new configuration variable 'default_branch' to fill automatically the "branch" input when creating a repository on MantisBT.

Copy link
Member

@dregad dregad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Adysone Thanks for your contribution.

I have not reviewed in detail or tested yet, but I noticed that you only updated the Gitlab plugin whereas the new config would also apply to other VCS plugins (at least the Git-based ones, GitHub, BitBucket, Cgit, GitWeb).

Also, please make sure you follow MantisBT coding guidelines (e.g. spacing around parenthesis in SourceGitlab.php changes).

SourceGitlab/SourceGitlab.php Outdated Show resolved Hide resolved
SourceGitlab/SourceGitlab.php Outdated Show resolved Hide resolved
@Adysone
Copy link
Author

Adysone commented Apr 11, 2019

All should be good now. I can't test other VCS than GitLab but it should be fine. Thanks for your answer.

Copy link
Member

@dregad dregad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. I had a closer look at this, and there is one thing that bothers me.

The new default_branch setting only applies to Git-based repositories, and does not make any sense in the context of other repo types (e.g. SVN). However, since the setting is global, the config page always displays it, which could be confusing to users of other VCS especially if they don't use any Git-based repositories.

IMO, the new setting should clearly indicate that it only applies to Git-based plugin types, and ideally should only be available if one of these is installed.

Moreover, it would be good to uniformize the labelling (the setting is called Primary Branch in the child plugins), and give an indication that it can be a comma-separated list of branches (or *).

I would also advise to avoid code duplication, and retrieve the default value via the MantisSourceGitBasePlugin abstract class. Maybe the display on config page could be handled from there as well, although that might be a bit tricky (might need creation of a new internal plugin event).

Now indicates that "default_master_branch" is only for Git based repositories.
@Adysone
Copy link
Author

Adysone commented Apr 24, 2019

The new default_branch setting only applies to Git-based repositories, and does not make any sense in the context of other repo types (e.g. SVN). However, since the setting is global, the config page always displays it, which could be confusing to users of other VCS especially if they don't use any Git-based repositories.

IMO, the new setting should clearly indicate that it only applies to Git-based plugin types, and ideally should only be available if one of these is installed.

Moreover, it would be good to uniformize the labelling (the setting is called Primary Branch in the child plugins), and give an indication that it can be a comma-separated list of branches (or *).

I can't check if a plugin is installed (I don't know Mantis API enough), but I improved labelling. 👍

I would also advise to avoid code duplication, and retrieve the default value via the MantisSourceGitBasePlugin abstract class. Maybe the display on config page could be handled from there as well, although that might be a bit tricky (might need creation of a new internal plugin event).

I can't do that either, I'm not good enough. 😄

If all I did is not enough, nevermind, you can close que PR, I will use my fork as plugin. At least I tried 😉

Thank you for your interest btw.

@dregad dregad modified the milestones: 2.3.0, 2.4.0 Sep 6, 2019
@dregad dregad closed this in 2c4c88f Feb 6, 2020
@dregad
Copy link
Member

dregad commented Feb 6, 2020

@Adysone I implemented your feature into the Git base plugin class as per my earlier comment. This means that your original code is all but gone, but thanks anyway for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants