Commit graph

143 commits

Author SHA1 Message Date
Scott Taylor
33ad38bfed templates: add "divergent" label to log for divergent changes
It would be good to include the word "divergent" in the log when a
change is divergent, since users are often unsure what's happening when
they see a divergent change, and giving them a term to search for would
be helpful. However, I don't think it looks good to put this label next
to the change ID itself if both are the same color, since it ends up
being hard to distinguish from the change offset at a glance. Also,
putting the label next to the change ID also messes up the alignment of
fields in the log. Therefore, I think it looks better to put the
"divergent" label at the end of the line.

Since divergence and hidden commits are similar, it makes sense for both
labels to be in the same place, so I also moved the hidden label to the
end for consistency.

One downside is that the labels are less obviously connected with the
change ID itself due to them being farther apart. I think this could be
fine, since they are still visually connected by being the same color.
2025-12-20 16:55:51 +00:00
Scott Taylor
144ba766b1 rewrite: add conflict labels for rebased commits
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
An example of rebasing `ysrnknol` onto `rtsqusxu`:

```
<<<<<<< conflict 1 of 1
%%%%%%% diff from: vpxusssl 38d49363 "base" (parents of rebased commit)
\\\\\\\        to: rtsqusxu 2768b0b9 "left" (rebase destination)
-base
+left
+++++++ ysrnknol 7a20f389 "right" (rebased commit)
right
>>>>>>> conflict 1 of 1 ends
```
2025-12-20 04:03:57 +00:00
Scott Taylor
0dffb6f108 templates: show change offsets for divergent and hidden commits
For now, I just replaced `??` with the change offset for divergent
commits. We can add an explicit "divergent" label later.
2025-12-16 02:02:31 +00:00
Yuya Nishihara
b9317da0f8 cli: enable glob string matching globally
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
The goal of this change is to unify defaults of string patterns in revsets and
command arguments. Glob is a good default because it's largely the same as exact
matching, and we can easily express substring patterns with globs.

The hint for "jj git fetch -b<glob>" is deleted since exact:<glob> is now
required in order to trigger the error.

This patch also updates help of clone/fetch --branch patterns. Glob and operator
support in refspecs is limited.
2025-12-15 04:27:32 +00:00
Yuya Nishihara
97375fa041 revset: enable glob string matching by default
Follows up c93682f2 "revset: parameterize default string pattern kind, add
config knob".
2025-12-15 04:27:32 +00:00
Yuya Nishihara
f4dc07eb3c cli: update hints to use new "track/untrack --remote" syntax 2025-12-13 01:32:49 +00:00
Yuya Nishihara
e921791574 cli: bookmark: add --remote argument to track/untrack, deprecate name@remote
These two are the last commands which don't support logical operators in string
patterns. The old <kind>:<name>@<remote> syntax had various problems including:

 1. substring patterns look weird (e.g. `substring:x@y` means `*x*@*y*`)
 2. cannot express "all but <name> for all remotes" (e.g. `(~gh-pages)@(*)`)

In addition to that, the revset parser doesn't support `<name>@<remote>`
prefixed by `<kind>:`.

This patch introduces separate --remote argument to address these problems. The
default is `glob:*` (or `~git`), so we wouldn't have to specify the remote in
many cases. One caveat is that `jj bookmark track` is not idempotent if there
are multiple remotes:

    # there are two remotes: origin and upstream,
    # and only foo@origin exists
    $ jj bookmark track foo
    # tracks foo@origin and creates new local bookmark foo
    $ jj bookmark track foo
    # tracks absent foo@upstream as we now have a local bookmark

This is wild. We might want to add a flag or a new command to track absent
remote bookmarks to push.

"Unmatched names" warnings are now emitted for bookmark and remote names
separately. To keep the implementation simple, the search space isn't restricted
by the other parameter. For example, "jj bookmark track foo --remote=bar" won't
show a warning if "foo" exists locally or in any remote.

Closes #4260
2025-12-13 01:32:49 +00:00
Yuya Nishihara
c6cc177103 config: remove outdated migration rules 2025-12-11 00:49:58 +00:00
Yuya Nishihara
6ec1c8e7d5 settings: parse auto-track-bookmarks as string matcher expressions
The settings field is now wrapped in Option because [remotes.<name>] may have
multiple fields, and some of them can be omitted.
2025-12-10 11:23:58 +00:00
Yuya Nishihara
26faf46dc7 cli: migrate "git push --bookmark" to parse_union_name_patterns() 2025-12-03 08:12:58 +00:00
Yuya Nishihara
906a5db495 cli: warn only unmatched exact patterns of bookmarks to push
This prepares for migration to parse_union_name_patterns().
2025-12-02 10:56:39 +00:00
Yuya Nishihara
d444f0578a cli: show warnings for unmatched exact bookmark/tag patterns to list
The idea is the same as filesets. We emit warnings for exact names that don't
exist in the search space.
2025-11-26 14:46:17 +00:00
Steve Klabnik
5b3aa51140 docs: jj-vcs.github.io -> jj-vcs.dev
As a follow-up to #8115, this moves all references in the codebase to use the new website.

I didn't update the older CHANGELOG entries because I figured they're intended
to be immutable.
2025-11-26 00:36:39 +00:00
Yuya Nishihara
3b37ed102e tests: specify string pattern prefix, use subject(glob:_) accordingly
Deprecation warnings will be emitted for default "substring:" patterns. This
change will suppress them. Since "glob:" will be the new default, I made these
tests use "glob:" when both "exact:" and "glob:" work.

Tests for the revset filter functions aren't updated.
2025-11-24 01:39:32 +00:00
Remo Senekowitsch
244cbf7d45 cli git push: deprecate --allow-new
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-11-22 08:18:44 +00:00
Remo Senekowitsch
faf5512482 tests: replace --allow-new with auto-track-bookmarks
This paves the way to deprecate the `--allow-new` flag on `jj git push`
without adding lots of deprecation warnings to test output snapshots.

The behavior of some tests is slightly changed, because
auto-track-bookmarks tracks all bookmarks at creation time, not when
they're about to be pushed. Where appropriate, I tracked bookmarks
manually instead of via the auto-track config.
2025-11-22 08:18:44 +00:00
Remo Senekowitsch
0bb55c6252 config: deprecate git.push-new-bookmarks 2025-11-22 07:09:29 +00:00
Remo Senekowitsch
e4d45dda34 tests: replace auto-local-bookmark with auto-track-bookmarks
This paves the way to deprecate `git.auto-local-bookmark` without
adding lots of deprecation warnings to test output snapshots.

The behavior of some tests is slightly changed, because
auto-track-bookmarks also tracks bookmarks that were created locally.
I think it just shows up in output snapshots as absent-tracked
bookmarks, without affecting what the test is about.
2025-11-21 05:15:55 +00:00
Martin von Zweigbergk
32aee9dbdf cli: deprecate --destination/-d in favor of --onto/-o
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
As we have discussed many times on Discord and GitHub, `--destination`
is not a great name because `--insert-before` and `--insert-after` are
also destinations. The most popular alternative seems to be
`--onto`. We already use that term in descriptions in several places,
such as in the help text for `rebase -d` where we say "The revision(s)
to rebase onto". This patch therefore renames the `--destination` flag
to `--onto`.

The short name naturally becomes `-o`. That is perhaps a little
unfortunate because it's a common short name for `--output <file>`
arguments, but we don't use that anywhere so it seems fine.

Perhaps we should also rename `--source` (used by `rebase` and `fix`)
to something else. Perhaps the most obvious name is `--descendants`,
but the short form would be `-d`, which is of course already taken by
`--destination` in the case of `rebase`. Either way, I'm leaving that
rename for later. It would be good to do it before next release if we
are going to do it, though.

Closes #7941
2025-11-08 14:56:37 +00:00
Yuya Nishihara
77e2c14d79 cli: git-push: allow pushing new bookmark to tracked remote
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-10-15 01:52:19 +00:00
Austin Seipp
ba24140f1d cli, lib: move to Rust 2024 language edition
This applies a `cargo fmt` and fixes clippy lints to keep the build
properly working.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2025-07-28 17:05:41 +00:00
Yuya Nishihara
6c8f6e9744 cli: allow "large" revsets by default
Since divergent/conflicted symbols no longer resolve to multiple revisions, it's
less scary to allow "large" revsets than before.

The config doc is removed because it's largely duplicated from the revsets doc,
and the config key will be removed.

#6016
2025-07-11 17:15:26 +00:00
Yuya Nishihara
3a8b83d1fc cli: git-push: make "change" bookmark names templated
Someone asked this on Discord, and it's useful if the bookmark name should
include e.g. issue number (which can be extracted from commit description.)
2025-07-02 01:55:59 +00:00
Yuya Nishihara
f7f85383bc tests: snapshot a few more colored outputs 2025-05-18 01:42:14 +00:00
Martin von Zweigbergk
acd824269f git: write change-id header by default
We haven't had any reports of problems from people who opted in. Since
it's early in the release cycle now, let's now test it on everyone who
builds from head, so we get almost a month of testing from those
people before it's enabled by default in a released version.

This impacts lots of test cases because the change-id header is added
to the Git commit. Most are uninteresting. `test_git_fetch` now sees
some divergent changes where it used to see only divergent bookmarks,
which makes sense.
2025-05-08 23:05:38 +00:00
Emily
adcc1de466 tests: remove obsolete insta::allow_duplicates! blocks 2025-05-07 19:29:20 +00:00
Emily
d2a8160a7a tests: remove obsolete git2 branches 2025-05-07 19:29:20 +00:00
Emily
2fec09ac60 tests: remove obsolete helpers 2025-05-07 19:29:20 +00:00
Emily
e942744f84 tests: deparameterize Git remote tests 2025-05-07 19:29:20 +00:00
Emily
f3de3858ef git: remove git.subprocess setting 2025-05-07 19:29:20 +00:00
Yuya Nishihara
6cba6d7ec2 cli: git-push: do not move existing local bookmarks by --change
An existing "push-*" bookmark should usually be in position. If it wasn't
because of e.g split, I think the user should be aware of that and take an
explicit action.
2025-04-19 01:26:40 +00:00
Emily
333d47f5e5 git: add deprecation warnings for git.subprocess 2025-04-08 10:36:46 +00:00
Remo Senekowitsch
b85bfa7221 cli: bookmark: list: update hint about deleted bookmarks
Deleting bookmarks now requires the --deleted flag.
(since: fb1a27ff09 )
2025-04-05 14:04:54 +00:00
Ilya Grigoriev
bedfb1ff51 tests: make git push --named tests demo differences in subprocess and libgit2 logic
Follows up on https://github.com/jj-vcs/jj/pull/5698 and
https://github.com/jj-vcs/jj/pull/6236.

The behavior of `--named` in corner cases differs. This wasn't detected
in #5698 because of a bug in the test that was fixed in #6236. This
commit better illustrates the more important case where the behavior is
the same, and the less important case where it differs.
2025-04-05 03:18:36 +00:00
Ilya Grigoriev
bd3cc7828a tests: add one more commit to git push --named test
Makes the diff in the following commit simpler.
2025-04-05 03:18:36 +00:00
Emily
370c624518 tests: add TestEnvironment::with_git_subprocess helper 2025-04-04 09:50:20 +00:00
Emily
c488a4030f tests: fix subprocess toggle in git push --named tests 2025-04-04 03:02:01 +00:00
Yuya Nishihara
0bcdedc159 tests: add missing insta::allow_duplicates! { .. }
Fixes #6230
2025-04-03 15:42:07 +00:00
Remo Senekowitsch
fb1a27ff09 cli: require --deleted to push deleted bookmarks 2025-04-01 15:58:50 +00:00
Robin Stocker
0456701e18 cli: Print @ and @- in status and print_updated_working_copy_stats
This helps newcomers learn/remember what @ and @- stand for.
2025-03-31 11:57:04 +00:00
Ilya Grigoriev
9db0739320 cli git push: new --named NAME=REVISION argument to create and immediately push bookmark
Fixes #5472
2025-03-31 03:51:28 +00:00
Yuya Nishihara
fb1c5da3db cli: git-push: remove support for existing long --change bookmark names
It's deprecated since 1aad250420 "Shorten the git push branch when possible
using the short change ID hash" (2023-01-12). I don't think we need the
fallback. I also removed the check for ambiguous prefixes as I believe it
wouldn't practically matter. If needed, we can add a check for existing bookmark
pointing to different commit. We can also make it templated with default
"'push-' ++ change_id.shortest(12)".
2025-03-28 14:34:11 +00:00
Baltasar Dinis
8ae80523e4 git: forward rejection reason on push
We've been finding that a lot of bug reports on `jj git push` come from
sub-standard error reporting on the reasons the failure happens.

It can come from a number of places:
 - hook failure
 - remote branch protection
 - git config

This commit forwards the reason as explained by the ouptut of git push
to help users figure out what is happening.
2025-03-26 04:46:38 +00:00
Baltasar Dinis
89bb1c4e71 git: refactor push ref error reporting
We need to report more complicated errors on push.
Firstly, we can have a mix of unexpected ref locations and remote
rejections. We should report both at the same time.

Second, git gives us a reason for why a push failed.
For this to work, it's relevant to refactor the current error reporting
path to allow us to inject this information.
2025-03-26 04:46:38 +00:00
Baltasar Dinis
f4d89fb6df cli/tests: add a filter to remove trailing whitespace in test_git_push_rejected_by_remove
The git remote sideband adds a dummy suffix of 8 spaces to attempt to clear
any leftover data. This is done to help with cases where the line is
rewritten.

However, a common option in a lot of editors removes trailing whitespace.
This means that anyone with that option that opens this file would make the
following snapshot fail. Using the insta filter here normalizes the
output.
2025-03-24 21:49:20 +00:00
Yuya Nishihara
d5226aad0a tests: port test_git_push.rs to TestWorkDir API 2025-03-23 01:31:28 +00:00
Yuya Nishihara
1466bce13c tests: move instantiation out of set_up() in test_git_{private_commits,push}.rs
set_up() doesn't have to create TestEnvironment by itself, and the local
TestWorkDir will borrow &test_env.
2025-03-23 01:31:28 +00:00
Emily
cce229d914 config: warn on unsupported git.subprocess = false 2025-03-16 06:07:28 +00:00
Emily
a56b78bdb6 git: make git2 support optional
This helps us prepare for removing the functionality down the line and
makes things easier for people building or packaging their own Jujutsu.
2025-03-16 06:07:28 +00:00
Ilya Grigoriev
acaedc3382 cleanup: enable unused_trait_names clippy lint and run clippy --fix 2025-03-16 00:35:56 +00:00