Skip to main content

A TUI that can be used as a diff editor in the jujutsu vcs.

Project description

jjdiff

PyPI

A TUI that can be used as a diff editor in the jujutsu vcs.

jjdiff will show all changes and allow you to navigate through them and (partially) select them to be included.

jjdiff makes it easy to navigate the diff by having a 2 dimensional cursor that can 'grow' and 'shrink'.

This cursor can operate on 3 levels:

  • Change: select an entire change
  • Hunk: select a group of edited lines in a file
  • Line: select a single edited line in a file

Keybindings

Command Key Description
exit escape, ctrl+c or ctrl+d Exit the diff editor with status code 1, causing the diff to not be applied.
next_cursor j, down or tab Select the next entry.
prev_cursor k, up or shift+tab Select the previous entry.
first_cursor g or home Select the first entry.
last_cursor G or end Select the last entry.
shrink_cursor l or right Shrink the cursor. So go from change to hunk and from hunk to line. If the cursor is on an unopened change it will open it first.
grow_cursor h or left Grow the cursor. So go from line to hunk and from hunk to change. If the cursor is on an opened change it will close it.
select_cursor space Mark everything selected by the cursor to be included. If everything is already marked it will exclude it instead. This will also select the next entry.
select_all a or ctrl+a Mark everything in the diff to be included. If everything is already marked it will exclude it instead.
confirm enter Confirm the selected changes.
undo u Undo the last command. Commands that only affect the UI state like changing the cursor and opening/closing changes are not included in this.
redo U Redo the last undone command. Commands that only affect the UI state like changing the cursor and opening/closing changes are not included in this.
open_all o Open all changes.
close_all O Close all changes.

Usage

jjdiff is available on pypi. You can use any way you are comfortable installing python applications.

You can then use it by adding the following settings to ~/.config/jj/config.toml:

[ui]
diff-editor = "jjdiff"
diff-instructions = false  # not required but recommended
diff-formatter = ["jjdiff", "--print", "$left", "$right"]  # to also format diffs using jjdiff

Configuration

jjdiff can be configured in ~/.config/jjdiff/config.toml or at $XDG_CONFIG_HOME/jjdiff/config.toml if set. The following configuration options are supported:

diff.deprioritize

This contains a list of gitignore style globs that can be used to deprioritize certain files in diffs. Deprioritizing has the following effects:

  • Deprioritized files are always at the end of the diff.
  • In jjdiff --print the changes in deprioritized files are not shown.

editor.default_open

Controls if changes are by default open or closed. Deprioritized files will remain closed by default even if this setting is set to true. Default is false.

editor.auto_open

When navigating away from an opened change, automatically closes it and opens the next one. Default is false.

format.tab_width

Controls as how many spaces a tab is formatted in the diff. Default is 4.

keybindings

A dictionary mapping command names to lists of keys that should trigger the command. The default value for each command matches the keybindings table shown earlier in this document.

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

jjdiff-0.6.2.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

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

jjdiff-0.6.2-py3-none-any.whl (32.3 kB view details)

Uploaded Python 3

File details

Details for the file jjdiff-0.6.2.tar.gz.

File metadata

  • Download URL: jjdiff-0.6.2.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jjdiff-0.6.2.tar.gz
Algorithm Hash digest
SHA256 645aa3c012def2292d7a0b557cb63f2504d7ef29f3db807dcaf9f65aa581c725
MD5 4474c348f7ee7c4824aa3942f126565a
BLAKE2b-256 4df46ad938be55a8dd1e65585af82b1815d90159aa2ce40c09ed5788f6697432

See more details on using hashes here.

Provenance

The following attestation bundles were made for jjdiff-0.6.2.tar.gz:

Publisher: publish.yml on daanvdk/jjdiff

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jjdiff-0.6.2-py3-none-any.whl.

File metadata

  • Download URL: jjdiff-0.6.2-py3-none-any.whl
  • Upload date:
  • Size: 32.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jjdiff-0.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bcc9586fd042e2ecf65e079bd697aadd0110be3cb1d6c2d7c54794c96287a260
MD5 ff8dcda459972bb6d977d2fb3d82a7d7
BLAKE2b-256 a3e435228aea150bd0b7cbf0342593581727520678f87f2a762e24748d42d63f

See more details on using hashes here.

Provenance

The following attestation bundles were made for jjdiff-0.6.2-py3-none-any.whl:

Publisher: publish.yml on daanvdk/jjdiff

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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