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

Gitlab integration development #92

Open
wants to merge 15 commits into
base: development
Choose a base branch
from

Conversation

brugidou
Copy link

This follows #91

Please review the following changes:

This was quickly written to work with less features than the github version (namely: comments)
No tests yet so you don't have to merge this if you don't feel like it
It works with any gitlab server (when the string 'gitlab' is in the hostname) using Gitlab API v3
It uses the gitlab gem

@@ -59,7 +59,12 @@ def remotes_for_url(remote_url)

# Find or create the correct remote for a fork with a given owner name.
def remote_for_request(request)
repo_owner = request.head.repo.owner.login
repo_owner = case request
when Request
Copy link
Owner

Choose a reason for hiding this comment

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

What's the difference herey? Either request is a Request or what exactly could it be? I guess a comment might help here.

Copy link
Author

Choose a reason for hiding this comment

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

Just fixed that, i explained in the commit message:

Back in the time, the request variable in this method could have been
something else when the Github provider didn't use the Request model.

Now this is always the case, so this check is unnecessary. In addition
the repo.head.user.login is cleaner to use than
request.head.repo.owner.login because the repo owner might get nil.

brugidou added 12 commits July 10, 2014 09:39
* create MR, list MR
* close does not work
* comments not implemented yet

This is a very ugly first version, without tests
(rebase on development branch)
Back in the time, the request variable in this method could have been
something else when the Github provider didn't use the Request model.

Now this is always the case, so this check is unnecessary. In addition
the repo.head.user.login is cleaner to use than
request.head.repo.owner.login because the repo owner might get nil.
simply call request()
@brugidou
Copy link
Author

Hi @b4mboo i just rebased on latest development branch.

I have been using this with my team for some time and it seems to work pretty well, would you consider reviewing this and let me know what we could improve or change?

@@ -57,7 +57,7 @@ def remotes_for_url(remote_url)

# Find or create the correct remote for a fork with a given owner name.
def remote_for_request(request)
repo_owner = request.head.repo.owner.login
repo_owner = request.head.user.login
Copy link
Owner

Choose a reason for hiding this comment

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

Is this really the same? Assuming the repository has multiple contributors, wouldn't it be possible that the latest commit has been made by someone else than the repo owner? In that case we'd end up with the wrong URL for the request.

Copy link
Author

Choose a reason for hiding this comment

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

actually i reverted this but there is an issue here:

owner.login is not part of the model, it works with github because you pass a github object to the owner field that happen to respond to the login method.

Copy link
Owner

Choose a reason for hiding this comment

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

Oh, good catch. I've been working quite a bit on getting rid of all generic things fromgithub.rb. Thereby finding a couple of similar issues. I'm gonna put this on my list and try to add it to the model as soon as possible.

@b4mboo
Copy link
Owner

b4mboo commented Jul 10, 2014

@brugidou Thanks for your contribution! I'm looking forward to extending git-review to Gitlab. Please take a look at my comments and tell me what you think.

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

Successfully merging this pull request may close these issues.

2 participants