Commit Graph

6545 Commits

Author SHA1 Message Date
Scott Taylor
2dd75b5c53 revset: add tracked/untracked_remote_branches()
Adds support for revset functions `tracked_remote_branches()` and
`untracked_remote_branches()`. I think this would be especially useful
for configuring `immutable_heads()` because rewriting untracked remote
branches usually wouldn't be desirable (since it wouldn't update the
remote branch). It also makes it easy to hide branches that you don't
care about from the log, since you could hide untracked branches and
then only track branches that you care about.
2024-07-13 10:43:21 -05:00
Austin Seipp
35b2136c68 cargo: run cargo update
Just to keep transitive deps fresh.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-07-13 06:26:16 -07:00
Austin Seipp
867851b108 cargo: update bytes 1.6.0 -> 1.6.1
v1.6.0 was yanked several hours ago, so this will block updates
if it isn't merged.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-07-13 06:26:16 -07:00
Yuya Nishihara
8ee5b783b3 formatter: minor cleanup in --color=debug handling 2024-07-13 11:08:01 +09:00
dependabot[bot]
5aa08042c5 cargo: bump the cargo-dependencies group with 2 updates
Bumps the cargo-dependencies group with 2 updates: [syn](https://github.com/dtolnay/syn) and [thiserror](https://github.com/dtolnay/thiserror).


Updates `syn` from 2.0.70 to 2.0.71
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.70...2.0.71)

Updates `thiserror` from 1.0.61 to 1.0.62
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.61...1.0.62)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-12 12:25:34 -05:00
dependabot[bot]
94dea0d26b github: bump github/codeql-action in the github-dependencies group
Bumps the github-dependencies group with 1 update: [github/codeql-action](https://github.com/github/codeql-action).


Updates `github/codeql-action` from 3.25.11 to 3.25.12
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](b611370bb5...4fa2a79536)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-12 12:25:21 -05:00
Tim Janik
11f56800fa test_gpg: fix warnings ending up on stdout
Signed-off-by: Tim Janik <timj@gnu.org>
2024-07-12 10:32:13 +09:00
Tim Janik
219a63540f local_working_copy: fix warnings ending up on stdout
As suggested by @crackcomm on discord, use eprintln!() to print warnings
to avoid messing up template output, e.g.:

jj --no-pager --ignore-working-copy show --tool true -T change_id -r rv...
rv...ignoring git submodule at "some/submodule"

Signed-off-by: Tim Janik <timj@gnu.org>
2024-07-12 10:32:13 +09:00
Yuya Nishihara
ffd7b41d2b revset: rename expect_literal_with() to expect_expression_with()
The return type T doesn't have to be a literal, and I'm going to use this
function to reparse fileset expression. We might also want to add another
expect_literal_with() helper that parses enum-like string value.
2024-07-12 10:31:45 +09:00
Philip Metzger
0690922ca1 FAQ: Add some more variants on how to deal with temporary files
The people in #323 think that we should document all patterns there are to deal with ignored files.
2024-07-11 20:01:57 +02:00
Jonathan Tan
de2940f9b7 --color=debug: combine segments with same labels
This not only makes the output easier to read, but also protects against
implementation detail changes in `write!` when used with a format
string (especially, how many times and with what strings it calls the
underlying writer).
2024-07-11 10:39:05 -07:00
Jonathan Tan
579ba8031b --color=debug: print unlabeled text without markup
This makes the debug output cleaner and makes the subsequent commit
easier to write.
2024-07-11 10:39:05 -07:00
dependabot[bot]
10a272aea6 cargo: bump clap_complete in the cargo-dependencies group
Bumps the cargo-dependencies group with 1 update: [clap_complete](https://github.com/clap-rs/clap).


Updates `clap_complete` 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...clap_complete-v4.5.8)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-11 17:40:09 +02:00
Yuya Nishihara
415c831e30 revset: flatten union nodes in AST to save recursion stack
Maybe it'll also be good to keep RevsetExpression::Union(_) flattened, but
that's not needed to get around stack overflow. The constructed expression
tree is balanced.

test_expand_symbol_alias() is slightly adjusted since there are more than
one representation for "a|b|c" now.

Fixes #4031
2024-07-11 11:20:25 +09:00
Yuya Nishihara
f90b061808 fileset: flatten union nodes in AST to save recursion stack
This is somewhat similar to templater where "x ++ y" operator is special cased.
2024-07-11 11:20:25 +09:00
dependabot[bot]
503771c33e github: bump actions/setup-python in the github-dependencies group
Bumps the github-dependencies group with 1 update: [actions/setup-python](https://github.com/actions/setup-python).


Updates `actions/setup-python` from 5.1.0 to 5.1.1
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](82c7e631bb...39cd14951b)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-10 18:17:58 +02:00
Benjamin Tan
f76d682bab readme: include link to wiki "Media" page and fix broken changelog link 2024-07-10 18:09:38 +08:00
Emily
93d76e5d8f str_util: support case‐insensitive string patterns
Partially resolve a 1.5‐year‐old TODO comment.

Add opt‐in syntax for case‐insensitive matching, suffixing the
pattern kind with `-i`. Not every context supports case‐insensitive
patterns (e.g. Git branch fetch settings). It may make sense to make
this the default in at least some contexts (e.g. the commit signature
and description revsets), but it would require some thought to avoid
more confusing context‐sensitivity.

Make `mine()` match case‐insensitively unconditionally, since email
addresses are conventionally case‐insensitive and it doesn’t take
a pattern anyway.

This currently only handles ASCII case folding, due to the complexities
of case‐insensitive Unicode comparison and the `glob` crate’s lack
of support for it. This is unlikely to matter for email addresses,
which very rarely contain non‐ASCII characters, but is unfortunate
for names and descriptions. However, the current matching behaviour is
already seriously deficient for non‐ASCII text due to the lack of any
normalization, so this hopefully shouldn’t be a blocker to adding the
interface. An expository comment has been left in the code for anyone
who wants to try and address this (perhaps a future version of myself).
2024-07-10 05:58:34 +01:00
Emily
a146145adb revset: fix mine() test comments 2024-07-10 05:58:34 +01:00
Emily
3567cba8c9 revset: fix email matching tests
The comments say “Can find a unique match by either name or email”,
but these weren’t checking for an email match.
2024-07-10 05:58:34 +01:00
Emily
0802a1502b revset: fix RevsetFilterPredicate comments
These support more types of pattern than just substring matching.
2024-07-10 05:58:34 +01:00
Scott Taylor
b27ff28956 cli: skip formatting instructions if not required
`tx.format_commit_summary()` can be expensive because it needs to build
an IdPrefixContext now, so it's best to avoid formatting instruction
messages unless they are actually required.
2024-07-09 20:24:14 -05:00
dependabot[bot]
a9b3273ec5 build(deps-dev): bump zipp from 3.18.2 to 3.19.1
Bumps [zipp](https://github.com/jaraco/zipp) from 3.18.2 to 3.19.1.
- [Release notes](https://github.com/jaraco/zipp/releases)
- [Changelog](https://github.com/jaraco/zipp/blob/main/NEWS.rst)
- [Commits](https://github.com/jaraco/zipp/compare/v3.18.2...v3.19.1)

---
updated-dependencies:
- dependency-name: zipp
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-10 10:06:48 +09:00
Yuya Nishihara
8856e6d328 diff: fix typo in get_diff_stat() comment 2024-07-10 10:05:31 +09:00
Yuya Nishihara
6a1d9262a0 diff: add short for Diff::for_tokenizer(_, find_line_ranges)
Line-by-line diff is common. Let's add a helper method for convenience.
2024-07-10 10:05:31 +09:00
dependabot[bot]
44818e9cf8 cargo: bump the cargo-dependencies group with 2 updates
Bumps the cargo-dependencies group with 2 updates: [clap](https://github.com/clap-rs/clap) and [syn](https://github.com/dtolnay/syn).


Updates `clap` from 4.5.8 to 4.5.9
- [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/v4.5.8...v4.5.9)

Updates `syn` from 2.0.69 to 2.0.70
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.69...2.0.70)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-09 10:42:40 -05:00
Yuya Nishihara
dce3ec7320 diff: simplify trimming of leading/trailing ranges to not rely on recursion
I don't think there's a possibility that uncommon_shared_words can become
non-empty by trimming the same amount of lines from both sides. Well, there's
an edge case regarding max_occurrences, but that shouldn't matter in practice.
2024-07-09 20:35:36 +09:00
Martin von Zweigbergk
fefe07b3c3 diff: consider uncommon words to match only if they have the same count
Patience diff starts by lining up unique elements (e.g. lines) to find
matching segments of the inputs. After that, it refines the
non-matching segments by repeating the process. Histogram expands on
that by not just considering unique elements but by continuing with
elements of count 2, then 3, etc.

Before this commit, when diffing "a b a b b" against "a b a b a b", we
would match the two "a"s in the first input against the first two "a"s
in the second input. After this patch, we ignore the "a"s because
their counts differ, so we try to align the "b"s instead.

I have had this commit lying around since I wrote the histogram diff
implementation in 1e657c5331. I vaguely remember thinking that the
way I had implemented it (without this commit) was a bit weird, but I
wasn't sure if this commit would be an improvement or not. The bug
report from @chooglen today of a case where we behave differently from
Git is enough to make me think that we make this change after all.

#761
2024-07-09 20:35:36 +09:00
Yuya Nishihara
831bbc0b11 diff: match up leading/trailing ranges if no match found by uncommon lcs
This is adapted from Breezy/Python patiencediff. AFAICT, Git implementation is
slightly different (and maybe more efficient?), but it's not super easy to
integrate with our diff logic. I'm not sure which one is better overall, but I
think the result is good so long as "uncommon LCS" matching is attempted first.

a9a3e4edc3/patiencediff/_patiencediff_py.py (L108)

This patch prevents some weird test changes that would otherwise be introduced
by the next patch.
2024-07-09 20:35:36 +09:00
Yuya Nishihara
ba087f9350 diff: remove unneeded mutation of histogram
The iterator might look a bit involved, but it clarifies that we never combine
words from different buckets.
2024-07-09 20:35:36 +09:00
dependabot[bot]
774769a00a cargo: bump the cargo-dependencies group with 3 updates
Bumps the cargo-dependencies group with 3 updates: [async-trait](https://github.com/dtolnay/async-trait), [serde](https://github.com/serde-rs/serde) and [syn](https://github.com/dtolnay/syn).


Updates `async-trait` from 0.1.80 to 0.1.81
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.80...0.1.81)

Updates `serde` from 1.0.203 to 1.0.204
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.203...v1.0.204)

Updates `syn` from 2.0.68 to 2.0.69
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.68...2.0.69)

---
updated-dependencies:
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-08 22:16:57 -05:00
Scott Taylor
a983abb594 cli_util: short-prefixes for commit summary in transaction
I've run into change ID prefixes being 4-5 characters instead of the
usual 1-2 characters in commands like `jj duplicate` and `jj split`
fairly often, and it seems like this should resolve that.
2024-07-08 08:23:39 -05:00
Scott Taylor
ddfce6d2c9 cli_util: extract new_id_prefix_context method 2024-07-08 08:23:39 -05:00
Yuya Nishihara
8bf10c8289 revset: update tests to not require private field access to err.kind 2024-07-08 10:44:43 +09:00
Vladimir Petrzhikovskii
802d2f5327 cli: recursively create clone destination path 2024-07-07 23:02:41 +02:00
Benjamin Tan
cd41bc3584 backout: accept multiple revisions to back out
Closes #3339.
2024-07-07 17:58:10 +08:00
dependabot[bot]
4b0cd02b5f build(deps-dev): bump certifi from 2024.2.2 to 2024.7.4
Bumps [certifi](https://github.com/certifi/python-certifi) from 2024.2.2 to 2024.7.4.
- [Commits](https://github.com/certifi/python-certifi/compare/2024.02.02...2024.07.04)

---
updated-dependencies:
- dependency-name: certifi
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-06 05:53:21 +01:00
Yuya Nishihara
5c649e734d cli: show commit summary at end of "branch set"
For the same reason as the previous commit.

Created and moved stats are printed separately because it's unusual to do both
within one "branch set" invocation.
2024-07-06 10:12:43 +09:00
Yuya Nishihara
a5095c1da6 cli: show commit summary at end of "branch create"
For the same reason as cdc0cc3601. This will help notice problems like wrong
target revision.

The warning for multiple branches is reorganized as a hint for "-r" option,
which I think is the main purpose of this warning. Unlike "squash", we don't
check if an argument can be parsed as a revset because branch name is usually
a valid symbol expression.
2024-07-06 10:12:43 +09:00
Yuya Nishihara
e02c576282 cli: print branch update stats within transaction
It's weird that export failure was emitted before the branch changes. Spotted
while adding "Created N branches" stats.
2024-07-06 10:12:43 +09:00
dependabot[bot]
9594a5c4a6 github: bump actions/upload-artifact in the github-dependencies group
Bumps the github-dependencies group with 1 update: [actions/upload-artifact](https://github.com/actions/upload-artifact).


Updates `actions/upload-artifact` from 4.3.3 to 4.3.4
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](65462800fd...0b2256b8c0)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-05 23:58:38 +08:00
Benjamin Tan
d2eb4d9b56 backout: include backed out commit's subject in new commit 2024-07-05 17:11:37 +08:00
Benjamin Tan
82bab36c0e backout: inline rewrite::back_out_commit 2024-07-05 17:11:37 +08:00
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