Commit graph

6552 commits

Author SHA1 Message Date
Benjamin Tan
456356aacb backout: add initial tests 2024-07-05 17:11:37 +08:00
Yuya Nishihara
44a39017f0 diff: highlight word-level changes in git diffs
The output looks somewhat similar to color-words diffs. Unified diffs are
verbose, but are easier to follow if adjacent lines are added/removed + modified
for example.

Word-level diffing is forcibly enabled. We can also add a config knob (or
!color condition) to turn it off to save CPU time.

I originally considered disabling highlights in block insertion/deletion, but
that wasn't always great. This can be addressed separately as it also applies
to color-words diffs. #3958
2024-07-05 16:07:12 +09:00
Yuya Nishihara
9e8a739e4d diff: deduplicate write() calls in show_unified_diff_hunks()
I'm going to add word-level highlighting there.
2024-07-05 16:07:12 +09:00
Scott Taylor
54877e1f79 workspace: abandon discardable working copy on forget
Forgetting a workspace removes its working-copy commit, so it makes
sense for it to be abandoned if it is discardable just like editing a
new commit will cause the old commit to be abandoned if it is
discardable.
2024-07-04 19:37:56 -05:00
Scott Taylor
622b606bfb repo: abandon working copy only if no other workspaces reference it
Currently, if two workspaces are editing the same discardable commit and
one of them switches to editing a different commit, it is abandoned even
though the other workspace is still editing it. This commit treats
workspaces as referencing their working-copy commits so that they won't
be abandoned.
2024-07-04 19:37:56 -05:00
Scott Taylor
b583075396 repo: extract maybe_abandon_wc_commit method 2024-07-04 19:37:56 -05:00
Scott Taylor
fa398ab405 cli: fix typo in jj workspace help 2024-07-04 19:37:56 -05:00
Yuya Nishihara
1cae93ce27 cli: rephrase hint for updating just one branch by "branch move"
Suggested by Ilya.
2024-07-05 07:58:18 +09:00
Yuya Nishihara
cdc0cc3601 cli: show commit summary at end of "branch move"
It's nice to see the result of "branch move", "create", etc., and this is more
important in "branch move" because the source branches can be specified in an
abstracted way. I originally considered printing a list of affected branches,
but it looked rather verbose. Since the destination revision is unique, we can
use commit_summary template instead.

This patch also removes a warning about multiple branches because the branch
names are included in the commit summary. I think the hint message is good
enough to signal possible mistake.
2024-07-05 07:58:18 +09:00
Benjamin Tan
0c0e001262 git init: add revset alias for trunk() when intializing with existing git repository 2024-07-04 23:04:19 +08:00
Benjamin Tan
d8899e1ae7 git clone: add revset alias for trunk() 2024-07-04 23:04:19 +08:00
Yuya Nishihara
79569f8248 changelog: move "rebase --skip-emptied" entry to unreleased section 2024-07-04 22:38:43 +09:00
Austin Seipp
c535b1c50d cargo: remove unused ouroboros dependency
I saw this while looking over the Cargo file and remembered Martin removed usage
of this a while back.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-07-03 19:27:22 -07:00
Matt Stark
31ac0d7e1f feat(rebase): Rename --skip-empty to --skip-emptied.
This is based on @martinvonz's comment in #3830 about the inconsistency between squash --keep-emptied and rebase --skip-empty.
2024-07-04 12:13:02 +10:00
Yuya Nishihara
034859b52f cli: branch: print stats even if just one branch is updated
We usually print stats at the end of mutable operation, and I think these
messages are useful even if N = 1. I understand that "Deleted N" (N > 1) is
unusual and the original intent of these messages was to signal possible
mistakes. However, I don't think printing N=1 stats would nullify the original
purpose.

No emptiness check is needed for delete/forget, but names can be empty in
track/untrack because of noop changes.
2024-07-04 10:58:50 +09:00
mlcui
c256ad8a0a windows: avoid UNC paths in run_ui_editor
See #3986 for more details. This is a no-op for non-Windows.
2024-07-04 11:30:20 +10:00
Matt Kulukundis
3c07d10c5b fix: fix change notes to move something from 0.19 to future 2024-07-03 20:53:40 -04:00
Matt Kulukundis
df8202af4e copy-tracking: initial implementation GitBackend::get_copy_records 2024-07-03 20:26:30 -04:00
Matt Kulukundis
2917dea0a1 copy-tracking: add a command line driver with a simple test 2024-07-03 20:26:30 -04:00
Matt Kulukundis
dab8a29683 copy-tracking: stub get_copy_records
- add the method and types for all backends
2024-07-03 20:26:30 -04:00
Matt Kulukundis
067d37aa3c copy-tracking: cargo add gix-format and gix diff-blob feature 2024-07-03 20:26:30 -04:00
Matt Kulukundis
aaa99e6dc7 diff: add a file-by-file variant for external diff tools 2024-07-03 20:09:17 -04:00
Skyler Grey
5de0ae84cd cargo: bump gix-actor to v0.31.4
Gitoxide, which is used to parse git commits, previously failed to parse
some malformed author/committer lines.

In 0.31.4, this parsing was made more lenient so as to better match
Git's parsing and avoid breaking on "in-the-wild" repositories such as
https://github.com/LibreOffice/core

Refs: https://github.com/Byron/gitoxide/issues/1438
Fixes: https://github.com/martinvonz/jj/issues/4008
2024-07-03 23:53:38 +01:00
Austin Seipp
74c275ed10 release: version 0.19.0
Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-07-03 14:37:40 -07:00
Austin Seipp
30bb90e417 changelog: minor touchups
Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-07-03 14:37:40 -07:00
Matt Stark
a840894a02 fix(changelog): Move --keep-emptied to the correct release.
Thanks @scott2000 for catching this.
2024-07-04 01:15:13 +10:00
Yuya Nishihara
455daa4d67 cli: remove deprecated --allow-large-revsets flag at all
It's been deprecated since v0.9.0 (2023-09-06). This patch doesn't add
changelog entry because the use of --allow-large-revsets was hard error.
2024-07-03 23:06:26 +09:00
Matt Stark
ca4eb60426 feat(squash): Add --keep-emptied flag
Fixes #3815
2024-07-03 12:03:26 +10:00
Matt Stark
7682a038a1 chore: Make squash tests log empty commits. 2024-07-03 12:03:26 +10:00
Scott Taylor
e54ecefbd4 commit: add --reset-author option 2024-07-02 18:21:21 -05:00
dependabot[bot]
b06b65b355 cargo: bump the cargo-dependencies group with 3 updates
Bumps the cargo-dependencies group with 3 updates: [pest](https://github.com/pest-parser/pest), [pest_derive](https://github.com/pest-parser/pest) and [serde_json](https://github.com/serde-rs/json).


Updates `pest` from 2.7.10 to 2.7.11
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.7.10...v2.7.11)

Updates `pest_derive` from 2.7.10 to 2.7.11
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.7.10...v2.7.11)

Updates `serde_json` from 1.0.119 to 1.0.120
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.119...v1.0.120)

---
updated-dependencies:
- dependency-name: pest
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: pest_derive
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-02 16:01:17 +00:00
Yuya Nishihara
f9a15ba542 diff: do not add excessive number of context lines to last unified-diff hunk
The last hunk could be truncated instead, but the .peekable() version is easier
to follow. If we truncated lines, we would have to adjust line ranges
accordingly.
2024-07-02 18:49:52 +09:00
Yuya Nishihara
ec709e7f8b diff: rely on emptiness of unified hunk lines whether to append "after" context
show_context_after was set once when DiffHunk::Different received, and was
never turned off. This means DiffHunk::Matching is not supposed to repeat.
Under this condition, we can assume that removed/added lines exist if lines
isn't empty.
2024-07-02 18:49:52 +09:00
Yuya Nishihara
318f594291 diff: simplify context line extraction by using DoubleEndedIterator 2024-07-02 18:49:52 +09:00
Yuya Nishihara
3d458c3e58 diff: extract helpers that push unified-diff hunk lines 2024-07-02 18:49:52 +09:00
Yuya Nishihara
a4f5462d07 tests: add test for leading/trailing diff context lines 2024-07-02 18:49:52 +09:00
Yuya Nishihara
5a85254bde docs: add customization example of color-words diff style
The default style is compatible with various terminal emulators, but I suspect
that many people wouldn't like underlines. Let's add an example to override it.
2024-07-02 18:47:36 +09:00
mlcui
3bca159b1a fake-editor: replace expectpath with dump-path
This allows us to assert the expected path in the test itself, rather
than in the fake editor.
2024-07-02 11:15:44 +10:00
Jonathan Tan
1eef1a4f55 workspace add: add filename context to FS error
At work, a user encountered a panic upon attempting to create a dir at
the line in the diff below, but it turned out to be difficult to debug
because I didn't know what the path was. There already is a mechanism to
add path context in the lib crate; make it available in the cli crate as
well, and use the mechanism to add path context to "workspace add".
2024-07-01 16:05:29 -07:00
Austin Seipp
f883ce92c6 github: publish binaries on push to main
These only occur on `main` pushes because we want to use --release binaries,
which will slow down the CI time a lot for integrating patches.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-07-01 10:01:51 -07:00
dependabot[bot]
7e1b162efb cargo: bump the cargo-dependencies group with 3 updates
Bumps the cargo-dependencies group with 3 updates: [clap](https://github.com/clap-rs/clap), [clap_complete](https://github.com/clap-rs/clap) and [serde_json](https://github.com/serde-rs/json).


Updates `clap` from 4.5.7 to 4.5.8
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.7...v4.5.8)

Updates `clap_complete` from 4.5.6 to 4.5.7
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.6...clap_complete-v4.5.7)

Updates `serde_json` from 1.0.118 to 1.0.119
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.118...v1.0.119)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: clap_complete
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-01 15:39:43 +00:00
Austin Seipp
a3ca701556 nix: remove a hack needed for nextest
The relevant upstream issue has been fixed since version 0.9.72,
as noticed by Emily.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-06-30 14:48:39 -05:00
Austin Seipp
fe40c9e364 nix: use -ld_new on macOS devshell
The new parallel macOS linker reduces link time for the debug `jj` binary from
3s to 0.7s on my M2 Macbook Air, which is a significant reduction for nearly
no cost at all. This only assumes that you have a new enough Xcode environment
as your default (where `/usr/bin/ld` resides.)

This change requires Sonoma and Xcode 15, but in theory I think we could target
a lower macOS SDK version in order to produce binaries that are more backwards
compatible, so the only real cost is that developers who also use Nix would
require Sonoma.
2024-06-30 14:48:39 -05:00
Philip Metzger
3b2197c74a docs: Add a Design Doc blueprint.
This should be the template for all new Design Docs, minor deviations aside.
Hopefully this makes the process a bit easier.
2024-06-30 15:37:40 +02:00
Philip Metzger
c4777e4721 docs: Formalize our design docs process a bit.
This adds the basic outline of _when_ a Design Doc should be written. See the next
commit in the stack for the blueprint. 

By adding this we hopefully can prevent unnecessary churn from new and longtime contributors, 
when they want to add a major feature or rewrite a core part of Jujutsu. The text is written
as a guideline, not a rule.
2024-06-30 15:37:40 +02:00
Yuya Nishihara
3792f4a019 templater: use .map_or() to silence clippy without sacrificing readability 2024-06-30 10:25:18 +09:00
Yuya Nishihara
0ca8502c5a diff: inline hunk processing in get_diff_stat()
This is simpler and more efficient. If we add word-diff to unified_diff_hunks(),
it will do more expensive work that isn't needed here.
2024-06-30 10:17:41 +09:00
Ilya Grigoriev
1b658ea80e lib id_prefix: look for divergent changes outside short prefix set
Fixes #2476.

Previously, if there was a change id match within the short prefix
lookup set, `jj` would not look for commits with that same change id
outside the short prefix set. So, it wouldn't find the conflicted
commits for a commit with a divergent (AKA conflicted) change id.
2024-06-29 11:44:26 -07:00
Ilya Grigoriev
360a2b6a8b lib id_prefix: demo bug #2476 in a test 2024-06-29 11:44:26 -07:00
Ilya Grigoriev
6d3d7c61f2 nightly clippy fixes
Includes a false-positive, https://github.com/rust-lang/rust-clippy/issues/13018.
2024-06-29 11:22:01 -07:00