Skip to main content

postmarketOS tools for interacting with gitlab MRs

Reason this release was yanked:

no plans to push further releases of mrhlpr to pip, use the alpine package or git clone instead!

Project description

This repository holds two programs, mrhlpr and mrtest. The mrhlpr program is described below, information about mrtest can be found in the postmarketOS wiki.

mrhlpr - merge request helper

Lightweight script to support maintainers of postmarketOS in the merge workflow on GitLab.

After installing mrhlpr (see below) and configuring a gpg key to use with git, this is the basic workflow. Further below is a full example session with example output.

  1. Use cd to enter a locally cloned git repository (e.g. pmaports.git).
  2. Checkout the merge request locally (mrhlpr checkout 123).
  3. Rebase on latest master (git rebase master).
  4. Add the MR-ID to all commit messages and sign them (mrhlpr fixmsg).
  5. Optionally squash all commits (git rebase -i master).
  6. Check if everything is fine (mrhlpr status).
  7. If everything looks good force push (git push --force).
  8. In the GitLab web UI: wait for CI, then merge.

Installation

Same as for pmbootstrap: clone the repo, create a symlink to mrhlpr.py in your PATH. Optionally set up autocompletion with argcomplete. See pmbootstrap's manual installation instructions for details.

Example Session

Start with mrhlpr checkout and the MR-ID. The built-in checklist will tell the next steps. All API requests get cached on disk.

$ cd ~/code/pmbootstrap/aports
$ mrhlpr checkout 81                                               
Download https://gitlab.com/api/v4/projects/postmarketOS%2Fpmaports/merge_requests/81
Download https://gitlab.com/api/v4/projects/8065375
Checkout feature/abuild-sign-noinclude from postmarketOS/feature/abuild-sign-noinclude
https://gitlab.com/postmarketOS/pmaports/merge_requests/81

"main/abuild-sign-noinclude: new aport" (!81)
10 commits from postmarketOS/feature/abuild-sign-noinclude

[OK ] Changes allowed
[OK ] Clean worktree
[NOK] Rebase on master
[NOK] MR-ID in commit msgs
[NOK] Commits are signed

Checklist:
* 10 commits: consider squashing ('git rebase -i origin/master')
* Rebase on master ('git rebase origin/master')
* Check again ('mrhlpr status')
$ git rebase -i master
$ mrhlpr status
https://gitlab.com/postmarketOS/pmaports/merge_requests/81

"main/abuild-sign-noinclude: new aport" (!81)
1 commit from postmarketOS/feature/abuild-sign-noinclude

[OK ] Changes allowed
[OK ] Clean worktree
[OK ] Rebase on master
[NOK] MR-ID in commit msgs
[NOK] Commits are signed

Checklist:
* Add the MR-ID to all commits and sign them ('mrhlpr fixmsg')
$ mrhlpr fixmsg
Appending ' (!81)' to all commits...
https://gitlab.com/postmarketOS/pmaports/merge_requests/81

"main/abuild-sign-noinclude: new aport" (!81)
1 commit from postmarketOS/feature/abuild-sign-noinclude

[OK ] Changes allowed
[OK ] Clean worktree
[OK ] Rebase on master
[OK ] MR-ID in commit msgs
[OK ] Commits are signed

Checklist:
* Origin up-to-date? ('git fetch origin')
* Pretty 'git log'? (consider copying MR desc)
* Push your changes ('git push --force')
* Web UI: comment about your reviewing and testing
* Web UI: approve MR
* Web UI: do (automatic) merge

Status descriptions

Status Description
[OK ] Everything is OK
[NOK] Something is wrong
[???] Seems OK, but manually check

mrhlpr.json

Optionally you can add a .mrhlpr.json file to your respository, this contains extra verification rules specific to your repository. An example file:

{
    "subject_format": {
        "pass": [
            "^[a-z]+/[a-z-0-9*{}]+: new aport(s|)( \\(!\\d+\\)|)$",
            "^[a-z]+/[a-z-0-9*{}]+: pkgrel bump( \\(!\\d+\\)|)$",
            "^[a-z-0-9*{}]+: new device \\([^\\)]+\\)( \\(!\\d+\\)|)",
            "^[a-z]+/[a-z-0-9*{}]+: upgrade to [0-9\\.a-z\\-_]+( \\(!\\d+\\)|)$"
        ],
        "unknown": [
            "^[a-z-0-9*{}\\/]+: [a-z\\-0-9*{}\\(\\)\\._ ]+( \\(!\\d+\\)|)$"
        ]
    }
}

Portability

This script is not postmarketOS specific, it should work with any GitLab repository. Right now, only gitlab.com is detected - but detecting any GitLab servers could be added in mrhlpr/gitlab.py:parse_git_origin() if desired.

Troubleshooting

mrhlpr -v displays debug log messages, such as all git commands and their output, as well as the locations of all http cache files.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mrhlpr-1.0.0.tar.gz (31.6 kB view details)

Uploaded Source

Built Distribution

mrhlpr-1.0.0-py3-none-any.whl (35.3 kB view details)

Uploaded Python 3

File details

Details for the file mrhlpr-1.0.0.tar.gz.

File metadata

  • Download URL: mrhlpr-1.0.0.tar.gz
  • Upload date:
  • Size: 31.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 pkginfo/1.8.2 readme-renderer/29.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.1 importlib-metadata/4.5.0 keyring/23.0.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for mrhlpr-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f5c80d6151049fb80d947407db68fc698aae632427adcc605597c74ac21dd5cc
MD5 c044bed5d5532b4f091bd168215106b4
BLAKE2b-256 83efdacc3f0e6bd66758dcb097f0fe840c40a7820432775ddadda227c22512af

See more details on using hashes here.

File details

Details for the file mrhlpr-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: mrhlpr-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 35.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 pkginfo/1.8.2 readme-renderer/29.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.1 importlib-metadata/4.5.0 keyring/23.0.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for mrhlpr-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d74fab112be375566c31f91c3f01bf3e77fa9c42aa431fc8e436e7457c946008
MD5 c3f5aa8d103bc54d5853436d905c162c
BLAKE2b-256 7524530c02c9a1aa0c5b7c1c8ff4a011fbe2c4312e94645923f963890e36129a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page