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.

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 with the following configuration options.

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.

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.5.0.tar.gz (22.0 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.5.0-py3-none-any.whl (31.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for jjdiff-0.5.0.tar.gz
Algorithm Hash digest
SHA256 d7d96b1743fb81e622ba3ba190de6c26b918d8e3ece7dbf5ce7da4137337d159
MD5 7ff5d2e95465be6faf010f08fa3496bb
BLAKE2b-256 03560791bd689c8489aba8c2c1f0b2167764f66983b186848e116c11805369ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for jjdiff-0.5.0.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.5.0-py3-none-any.whl.

File metadata

  • Download URL: jjdiff-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 31.7 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.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2adb9c02776a950ad411b06b2334a7bbb37419ad67b121ab84a2ade3b2ce730
MD5 371d075577284d935b7e25fe5f8d276d
BLAKE2b-256 2fe9dd228557706769fc572c24f21373ace68b3ff6c8f8008141374c41f1e2f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for jjdiff-0.5.0-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