zaquestion / lab

Lab wraps Git or Hub, making it simple to clone, fork, and interact with repositories on GitLab
https://zaquestion.github.io/lab
Creative Commons Zero v1.0 Universal
1.1k stars 103 forks source link

lab issue create mr #844

Open dooraim opened 1 year ago

dooraim commented 1 year ago

Hi, I saw that when you create an Issue it is not possible to create an MR, which instead you can do through Gitlab's web interface, as shown in the image below. Is this features still not yet available or will it not be implemented?

immagine

prarit commented 11 months ago

Sorry for the very late reply. I am going through some old issues and seeing what can be done to resolve them.

@zampierilucas , I don't see anything obvious with the Merge Request or Issue APIs that allows this sort of linking, even though there are references to being able to do so. Any idea on where I might find the API magic?

zampierilucas commented 11 months ago

@prarit The feature @dooraim is looking for is creating_merge_requests.html#from-an-issue, and from those docs "selecting Create merge request redirects to the merge request creation form instead of immediately creating the merge request.", so there's no API to directly do that.

But what GitLab does in the backend is quite simple, it does two things:

So the resulting mr is an empty(no commits) mr like: image

This can probably be scripted using pipes in lab, but we can also implement it, wdyt?

prarit commented 11 months ago

Interesting thought. But I wonder if it is easier just to append the Description with a 'Closes' line?

zampierilucas commented 11 months ago

Sure, GitLab will see as the same as using the button on the issue, we would only be missing the convenience of having a branch name and description based on the issue data, unless manually created.