Collection of tools for dealing with GitLab Merge Requests, with an Alpine flavour.
Small python3 utility to create Merge Requests on GitLab, with special support for Alpine Linux's self-hosted instance.
Unless you need the absolutely newest version immediately please use a system package.
This package is available in the testing repo of Alpine Linux
apk add mkmr
The following are required to be set up in the repository you're working on:
- A remote called
--origin=ORIGIN), the URL must point to your fork of the project you want to contribute to.
- A remote called
--upstream=UPSTREAM), the URL must point to the canonical repository of the project you want to contribute to.
git remote -v
origin https://gitlab.alpinelinux.org/Leo/aports.git (fetch) origin email@example.com:Leo/aports.git (push) upstream https://gitlab.alpinelinux.org/alpine/aports.git (fetch) upstream firstname.lastname@example.org:alpine/aports.git (push)
Note that the fetch URL will be used for all interactions, and in fact only https:// are supported, with other ssh URL types like ssh:// and git:// being silently converted to https://.
- (first-time users) call the script with
--token=TOKEN, it will be written automatically to the configuration and won't be necessary in any further usage.
Simple usage and common examples
After doing set-up one can run mkmr easily with:
It will automatically create a merge request from the active branch to the master branch.
Different source and target branches
Sometimes you want to create a merge request that targets another branch, sometimes you want another branch to be the source of changes in the merge request, sometimes you want both.
For those use
--target=TARGET switches like so:
mkmr --source=foo --target=bar
Dealing with titles, descriptions and labels
mkmr will automatically derive the title and description from the commit of the merge request, if there are multiple commits then you will be prompted with a list to pick one.
If you are using Alpine Linux's GitLab instance then it will also derive relevant labels for your merge request.
If you wish to pass your own title and description then use
--description=DESCRIPTION like so:
mkmr --title="This is an amazing merge request"
mkmr --title="Not amazing merge request" --description="sike!"
-e switch, when used, will open the title and description in your text editor (as decided by $VISUAL, then $EDITOR, then vim, emacs, nano).
If you want to add labels to your merge request then use
--labels=LABELS, the labels should be separated by a comma, like so:
Switching to a new personal access token
Eventually you want to rotate your personal access tokens, in that case you can
--overwrite options. Usage of the latter means
the configuration file will have its
[gitlab.alpinelinux.org] url = https://gitlab.alpinelinux.org private_token = BAR
mkmr --token=FOO --overwrite
[gitlab.alpinelinux.org] url = https://gitlab.alpinelinux.org private_token = FOO
mkmr uses INI-formatted files in the same way as python-gitlab, in fact mkmr will just write a section (like
[gitlab.alpinelinux.org]) and in it, will write the
url keys with the relevant values.
After writing it, the configuration file will be passed to python-gitlab, which is used for interacting with the GitLab API.
The following locations are searched (if none of them exists them the first one will be created automatically):
- $XDG_CONFIG_HOME/mkmr/config (only if XDG_CONFIG_HOME is set)
- $HOME/.config/mkmr/config (if XDG_CONFIG_HOME is not set but HOME is)
The --config switch can be used to pass a full path to a configuration file like so:
Release history Release notifications
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size mkmr-0.0.13-py3-none-any.whl (18.6 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
|Filename, size mkmr-0.0.13.tar.gz (16.1 kB)||File type Source||Python version None||Upload date||Hashes View|