Tool for combining GitHub pull requests.
Project description
Tool for combining GitHub pull requests.
- Code:
- Issues:
- License:
MPL v2
- Documentation:
this README
Install
With pipx:
pipx install paul-mclendahand
With pip from PyPI:
pip install paul-mclendahand
With pip from GitHub main branch:
pip install https://github.com/willkg/paul-mclendahand/archive/main.zip
Quick start
Configure git to fetch pull request references
First, you need to have git configured to fetch pull request references. I have an additional fetch line in my remote for github.com. For example, this is what I have for socorro:
[remote "upstream"] url = git@github.com:mozilla-services/socorro.git fetch = +refs/heads/*:refs/remotes/upstream/* fetch = +refs/pull/*/head:refs/remotes/upstream/pr/*
The line you need to add is the last one. Make sure to use the right remote:
fetch = +refs/pull/*/head:refs/remotes/upstream/pr/* ^^^^^^^^ use your remote name here
After adding that, when you do git pull, it’ll pull down all the references for pull requests. They’ll be available as upstream/pr/PRNUM.
Configure pmac
pmac needs to know the GitHub user and GitHub project.
You can set configuration in the setup.cfg file:
[tool:paul-mclendahand] github_user=user github_project=project git_remote=git-remote-name main_branch=git-main-branch-name
You can override the setup.cfg variables with environment variables:
PMAC_GITHUB_USER=user PMAC_GITHUB_PROJECT=project PMAC_GIT_REMOTE=git-remote-name PMAC_MAIN_BRANCH=git-main-branch-name
You can also pass the git remote on the command line using the --git_remote argument.
If you don’t specify a remote, then pmac will guess it using a highly sophisticated deterministic stochastic rainbow chairs algorithm.
Using pmac
After you’ve configured git, then you can use pmac like this:
Create a new branch:
git checkout <MAIN-BRANCH> git checkout -b update-prs
List open PRs:
pmac listprs
Combine some pull requests into it:
pmac add 5100 5101 5102
Use the same pull requests numbers as on GitHub.
If you hit a cherry-pick conflict, pmac will tell you. You can edit the file in another terminal to manually resolve the conflict. Then do:
git add FILE git commit
After that, you can continue with pmac.
When you’re done, push the branch to GitHub and create a pull request.
pmac can help with the PR description:
pmac prmsg
Why does this project exist?
Two main reasons.
First, GitHub doesn’t support combining pull requests. There is a forum post about it here: https://github.community/t5/How-to-use-Git-and-GitHub/Feature-Request-combine-pull-requests/td-p/27660
Second, dependabot (also owned by GitHub) doesn’t support grouping dependency updates into a single pull request. If you have 50 dependency updates, it creates 50 pull requests. I have a lot of projects and lack of grouping updates makes monthly maintenance miserable. There’s an issue for this: https://github.com/dependabot/feedback/issues/5
History
1.2.0 (June 24th, 2020)
NEW FEATURES:
Added a PMAC_MAIN_BRANCH environment variable and main_branch configuration option which specify the name of the main branch. (#12)
1.1.0 (April 7th, 2020)
NEW FEATURES:
Added a --git_remote argument, PMAC_GIT_REMOTE environment variable, and git_remote configuration option which, when specified, will cause pmac to use that as the remote name and not guess. (#10)
OTHER THINGS:
Added a Makefile because that’s how I roll.
Tweaked pmac --help so it shows the version and release date and link to issue tracker.
Cleaned up README.
Made a peanut butter pie and ate it.
1.0.0 (January 14, 2020)
Initial writing.
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
Built Distribution
File details
Details for the file paul-mclendahand-1.2.0.tar.gz
.
File metadata
- Download URL: paul-mclendahand-1.2.0.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 667c916a1e0ff0041ef8ad164541455df8b93d74c0f828b6cde01f1ccb8cf5c4 |
|
MD5 | e5c54698a28fdcf28a5b5b22ef16f091 |
|
BLAKE2b-256 | 53990559456f7fc5a699c4ee498324805f6bc1051af010c48d942d724a703642 |
File details
Details for the file paul_mclendahand-1.2.0-py2.py3-none-any.whl
.
File metadata
- Download URL: paul_mclendahand-1.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ea4d24e8f93b3ad31302da3952590ce457542a14794568d9ead9d3aee30f048 |
|
MD5 | 0256ff33501ca31e762dd79af9e74477 |
|
BLAKE2b-256 | 9adea3ba8ec284239f3ac54ef89cc704f34f3b49d9b286211ffadbbf5d0c8896 |