A pre-commit integration for jj
Project description
jj-pre-push
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:
- https://www.aazuspan.dev/blog/automating-pre-push-checks-with-jujutsu/
- Various comments on https://github.com/jj-vcs/jj/issues/405
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:
- Determines which bookmarks the corresponding
jj git pushwill update on the remote, and how they would change. - 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
- If all hooks succeeded on all branches, executes
jj git pushwith the arguments provided. - 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
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f90d3bd06d0e9086f77d21e893402ad3dbb6fda5a088fe56c1aaf117435de8f
|
|
| MD5 |
f374febc110e3d0c3d97ecbde77de8bb
|
|
| BLAKE2b-256 |
8c604d6e9079c4826f9d9fce5e9e449f951062d68708626f42afccada604b1b6
|
File details
Details for the file jj_pre_push-0.1.0.post1-py3-none-any.whl.
File metadata
- Download URL: jj_pre_push-0.1.0.post1-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de01c98c92840c63aed987ac2c5fed43a5694ee6481cef086ffc88028b900d2c
|
|
| MD5 |
8f814c6ff57190388f4359b9160ed091
|
|
| BLAKE2b-256 |
707959dd8872c1a87894fd09b2b51c84ccb25d39b7057587634d9d0ae49f00c8
|