Skip to main content

A pre-commit integration for jj

Project description

jj-pre-push

PyPI

A very limited integration between jj and pre-commit allowing you to run your pre-push hooks in a colocated jj/git repository.

I don't expect this to last forever, it's just a stopgap until some jj-native mechanism arrives that can take over.

Prior art:

Usage

Use jj-pre-push push (or an alias - personally I use jj push) as a replacement for jj git push. It takes all the same arguments, and does the following:

  1. Determines which bookmarks the corresponding jj git push will update on the remote, and how they would change.
  2. For each of these bookmarks in turn:
    • Checks out the bookmark to the working copy
    • Runs the pre-push hooks defined in your .pre-commit-config.yaml on the files that have changed between the remote branch's old and new states. (This is for forward movements of existing branches; for sideways/backwards movements and new branches we currently check all files.)
    • Reports any failures; and if any files were modified reports the change ID in which these modifications can be found
  3. If all hooks succeeded on all branches, executes jj git push with the arguments provided.
  4. Returns the working copy to its original change.

If there is no .pre-commit-config.yaml in your workspace root, jj-pre-push push immediately delegates to jj git push.

Installation

If you have uv installed and you're planning to use an alias anyway, you can avoid explicitly installing at all with uvx, e.g. with this jj configuration for jj push:

[aliases]
push = ["util", "exec", "--", "uvx", "jj-pre-push", "push"]

Otherwise, install the PyPI package jj-pre-push in whichever way you prefer; e.g. uv tool install jj-pre-push or pip install jj-pre-push. (Or clone this repository and install it in editable mode if you want to hack on it.)

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

jj_pre_push-0.1.0.post1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jj_pre_push-0.1.0.post1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file jj_pre_push-0.1.0.post1.tar.gz.

File metadata

  • Download URL: jj_pre_push-0.1.0.post1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.2

File hashes

Hashes for jj_pre_push-0.1.0.post1.tar.gz
Algorithm Hash digest
SHA256 6f90d3bd06d0e9086f77d21e893402ad3dbb6fda5a088fe56c1aaf117435de8f
MD5 f374febc110e3d0c3d97ecbde77de8bb
BLAKE2b-256 8c604d6e9079c4826f9d9fce5e9e449f951062d68708626f42afccada604b1b6

See more details on using hashes here.

File details

Details for the file jj_pre_push-0.1.0.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for jj_pre_push-0.1.0.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 de01c98c92840c63aed987ac2c5fed43a5694ee6481cef086ffc88028b900d2c
MD5 8f814c6ff57190388f4359b9160ed091
BLAKE2b-256 707959dd8872c1a87894fd09b2b51c84ccb25d39b7057587634d9d0ae49f00c8

See more details on using hashes here.

Supported by

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