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

create method to determine if merge request already exists #60

Closed
logicminds opened this issue Jun 23, 2014 · 1 comment
Closed

create method to determine if merge request already exists #60

logicminds opened this issue Jun 23, 2014 · 1 comment

Comments

@logicminds
Copy link
Contributor

Currently there is no way to determine if a merge request already exists. We need a method called merge_request_exists? to find out if the request needs to be created or not.

Currently this is what I am doing in my own wrapper code.

 # merge_request fetches all the available merge requests with given state
  # this is supposed to work but the data being returned is not correct
  def merge_request(src,dst, email=author_email)
    merge_requests.find_all { |mr| mr.target_branch == dst and mr.source_branch == src and mr.author.email == email }

  end

  #retrives all the current merge requests with the state filtered
  def merge_requests(id=project_id, state='active')
    client.merge_requests(id).find_all {|mr| mr.state == state }
  end
@NARKOZ
Copy link
Owner

NARKOZ commented Jun 24, 2014

merge_request doesn't fetch all the available merge requests. See the docs.

Client only wraps the REST API provided by GitLab. Anything else is up to you.
Basically you need to get all merge requests for a project and then filter that array using ruby.

@NARKOZ NARKOZ closed this as completed Jun 24, 2014
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

No branches or pull requests

2 participants