Package: mkmr
mkmrSmall python3 utility to create Merge Requests on GitLab, with special support for Alpine Linux's self-hosted instance.InstallationUnless you need the absolutely newest version immediately please use a system package.This package is available in the community repo of Alpine LinuxIf you packaged it for your distro please tell me so I can add it# apk add mkmrSet-upThe following are required to be set up in the repository you're working on:A remote calledorigin(or use--origin=ORIGIN), the URLmustpoint to your fork of the project you want to contribute to.A remote calledupstream(or use--upstream=UPSTREAM), the URLmustpoint to the canonical repository of the project you want to contribute to.Example:$gitremote-v
originhttps://gitlab.alpinelinux.org/Leo/aports.git(fetch)origingit@gitlab.alpinelinux.org:Leo/aports.git(push)upstreamhttps://gitlab.alpinelinux.org/alpine/aports.git(fetch)upstreamgit@gitlab.alpinelinux.org:alpine/aports.git(push)Note that the fetch URL will be used for all interactions, and in fact only https:// is 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 examplesAfter doing set-up one can run mkmr easily with:$mkmrIt will automatically create a merge request from the active branch to the master branch.Different source and target branchesSometimes 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--source=SOURCEand--target=TARGETswitches like so:$mkmr--target=dev
$mkmr--source=foo
$mkmr--source=foo--target=barDealing with titles, descriptions and labelsmkmr 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--title=TITLEand--description=DESCRIPTIONlike so:$mkmr--title="This is an amazing merge request"$mkmr--title="Not amazing merge request"--description="sike!"The--editor-eswitch, 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:$mkmr--labels=help-wanted,good-first-issueSwitching to a new personal access tokenEventually you want to rotate your personal access tokens, in that case you can
combine the--token=TOKENand--overwriteoptions. Usage of the latter means
the configuration file will have itsprivate_tokenoverwritten.$ cat $XDG_CONFIG_HOME/mkmr/config[gitlab.alpinelinux.org]url=https://gitlab.alpinelinux.orgprivate_token=BAR$ mkmr --token=FOO --overwrite$ cat $XDG_CONFIG_HOME/mkmr/config[gitlab.alpinelinux.org]url=https://gitlab.alpinelinux.orgprivate_token=FOOConfigurationmkmr 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 theprivate_tokenandurlkeys 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:$mkmr--config=/tmp/config