Skip to main content

Tool to automate merging of topic branches

Project description

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.

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

smush-0.0.7.tar.gz (8.7 kB view details)

Uploaded Source

Built Distributions

smush-0.0.7-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

smush-0.0.7-py2-none-any.whl (10.9 kB view details)

Uploaded Python 2

File details

Details for the file smush-0.0.7.tar.gz.

File metadata

  • Download URL: smush-0.0.7.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for smush-0.0.7.tar.gz
Algorithm Hash digest
SHA256 877022260f98dabf166c08621eafc80c9cb07591c7e0cf6b1464cfb4e1690d06
MD5 03ff959e81bfd9cd3c23434e51b9f380
BLAKE2b-256 d444d67f3f67e92258293905e55f368fd5960ea3e2993f8cf62bb398ed4493c6

See more details on using hashes here.

File details

Details for the file smush-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: smush-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for smush-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 593a57258601af49e10ca0af4f281b4bf5bd1230f5ae60081392bee1767d4191
MD5 f2f757bb8176db1ffc05677d1fdfa307
BLAKE2b-256 de190094936fe11ad071d7d92d357ca0a0572d81a1281d7023bbe93841e8d656

See more details on using hashes here.

File details

Details for the file smush-0.0.7-py2-none-any.whl.

File metadata

  • Download URL: smush-0.0.7-py2-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 2
  • Uploaded using 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

File hashes

Hashes for smush-0.0.7-py2-none-any.whl
Algorithm Hash digest
SHA256 6e046f392a463402acfb80daf6b10d7f29325f3edd6a9e1637f6b6cc464158fe
MD5 f73558e746cf783059ed70fcf68df759
BLAKE2b-256 0c31700f8c4cd17bf7f4435bcd8e84d5d10420ed562e1202ac395930c3762fea

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