Skip to main content

Tool to automate merging of topic branches

Summary

This CLI tool automates steps required to cleanly merge a topic branch into a base branch. No merge commits are made. Before merging, the topic branch is rebased so it can be merged using --ff-only then pushed.

If merging this way and using GitHub, and a pull request exists for the topic branch, the pull request will be automatically marked as merged and closed.

Functionality

Usage: smush [topic branch]

Does the following:

  1. Optionally verify (depending on config file settings/CLI options) if open pull request exists for topic branch

  2. Optionally verify (depending on config file settings/CLI options) if pull request base branch matches configuration

  3. Optionally shows text reminders (if set in config file) before merge

  4. Updates base branch

  5. Rebases topic branch using base branch

  6. Force pushes topic branch

  7. Displays unmerged commits

  8. Displays commit style issues (see Style Checking)

  9. Prompts to allow interactive rebasing if more than one commit is to be merged

  10. Asks confirmation to go ahead with merge

  11. Merges topic branch into base branch

  12. Pushes base branch

  13. Deletes topic branch

  14. Optionally (depending on CLI options) deletes local topic branch

  15. Optionally shows reminders (if set in config file) after merge

If no topic branch is specified, the active branch will be used.

The --skip-pr-check option skips step 2 of the above sequence.

The --skip-style-check option skips step 8 of the above sequence.

The --delete-local option deletes the local topic branch.

Installation

Install from Python Package Index:

pip install smush

Or…

  1. Install the required Python modules:

    pip install -r requirements.txt

  2. Stick the bin/smush script somewhere you can run it from.

Use without configuration

Smush can be run without configuration using command-line options.

Example:

smush --base-branch="qa/2.6.x" --github-owner="artefactual" \
    --github-repo="atom" dev/issue-13177-remove-js-file-reference

Configuration

Edit the $HOME/.smush.yml YAML-formatted configuration file and set base branch to desired base branch.

Example:

base branch: qa/2.5.x

Setting github owner and github repo in your configuration file can, optionally, enable you to have smush check to make sure an open pull request exists for the topic branch.

Setting before notes in your configuration file can, optionally, display notes/reminders before you merge. Likewise, setting after notes can display notes/reminders after you merge.

Setting syntax check scripts in your configuration file can, optionally, check files, changed by commits in your topic branch, using an external script that you specify. Different scripts can be specified for different file extensions.

Example:

syntax check scripts:
    php: "php -l {}"

The --profile option can be used to load an alternative configuration. Using --profile=backport, for example, would result in $HOME/.smush-backport.yml being used as a configuration file.

Style checking

The commit style check checks commit messages to make sure that:

  1. The first line of the commit message (described as the “subject line”) isn’t over 50 characters in length.

  2. Subsequent lines in the commit message (described as “body lines”) aren’t over 72 characters in length.

  3. There’s a blank line between the subject line of the commit message and any subsequent body lines.

This convention, and the reasoning behind it, is described here:

https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html

If you want to check the style of a branch without merging it, you can use the --check option.

Branch creation

If you want to create a topic branch, locally and remotely, from the base branch, you can use the --new option.

Metadata

Release files for smush 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smush 0.0.7
File Size Uploaded Provenance
smush-0.0.7.tar.gz 8.7 kB Without provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for smush 0.0.7
File Interpreter ABI Platform
smush-0.0.7-py3-none-any.whl Python 3 none any Details
smush-0.0.7-py2-none-any.whl Python 2 none any Details

Total release size: 30.5 kB

Release files / smush-0.0.7.tar.gz

Download URL smush-0.0.7.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
877022260f98dabf166c08621eafc80c9cb07591c7e0cf6b1464cfb4e1690d06
BLAKE2b-256 checksum
How to use checksums
d444d67f3f67e92258293905e55f368fd5960ea3e2993f8cf62bb398ed4493c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9

Release files / smush-0.0.7-py3-none-any.whl

Download URL smush-0.0.7-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
593a57258601af49e10ca0af4f281b4bf5bd1230f5ae60081392bee1767d4191
BLAKE2b-256 checksum
How to use checksums
de190094936fe11ad071d7d92d357ca0a0572d81a1281d7023bbe93841e8d656
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9

Release files / smush-0.0.7-py2-none-any.whl

Download URL smush-0.0.7-py2-none-any.whl
Size 10.9 kB
Tags Python 2
SHA-256 checksum
How to use checksums
6e046f392a463402acfb80daf6b10d7f29325f3edd6a9e1637f6b6cc464158fe
BLAKE2b-256 checksum
How to use checksums
0c31700f8c4cd17bf7f4435bcd8e84d5d10420ed562e1202ac395930c3762fea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9

Security for smush 0.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page