Commit graph

72 commits

Author SHA1 Message Date
David Higgs
59f80b1133 tests: confirm bookmark set warns when auto-tracking existing bookmark 2025-12-06 13:11:12 +00:00
Yuya Nishihara
713e57e6fe cli: bookmark, tag: migrate to parse_union_name_patterns()
"jj bookmark move" no longer shows a warning for named bookmarks not pointing to
the --from revisions. I think that's okay. `move --from=REV 'PATTERN ~ main'` is
a valid use case, and "main" shouldn't be warned.
2025-12-02 01:51:22 +00:00
Yuya Nishihara
99b5d32e02 cli: warn only unmatched exact patterns of remote bookmarks 2025-12-02 01:51:22 +00:00
Yuya Nishihara
7d9d15b534 cli: warn only unmatched exact patterns of local bookmarks
This prepares for migration to parse_union_name_patterns(). find_bookmarks*()
will be inlined, and new helper function for unmatched warnings will be added.
2025-12-02 01:51:22 +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
Yuya Nishihara
3f88ea78f1 cli: use revset parser to parse bookmark/tag list patterns
These commands are easy ones. The other commands error out if one of the
patterns doesn't match anything. I'll make them warn only exact patterns instead
to keep the implementation simple. I'll also add warnings to these list
commands.
2025-11-23 03:00:12 +00:00
David Higgs
1ddada1a24 tests: exercise more tracking conflict cases
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 14:38:53 +00:00
David Higgs
58edd0f731 tests: exercise renaming an untracked bookmark 2025-11-22 14:38:53 +00:00
David Higgs
7afa6273ca tests: exercise tracking non-existent remote bookmarks 2025-11-22 14:38:53 +00:00
David Higgs
062f950be3 tests: exercise moving multiple bookmarks by name 2025-11-22 14:38:53 +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
Remo Senekowitsch
4216aa6758 config: add remotes.<name>.auto-track-bookmarks
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
This configuration allows users to express a set of bookmarks that
should be automatically tracked when first encountered. This includes
on clone, fetch, create and set.

Until now, the configuration values `git.push-new-bookmarks` and
`git.auto-local-bookmark` fulfilled parts of those use cases. However,
both options represent an "all or nothing" approach. By turning them on,
users risk tracking and pushing more bookmarks than desired.

By using a bookmark pattern, users can express that they want to
auto-track bookmarks that belong to them (e.g. `glob:my-name/*`).
2025-11-18 15:10:56 +00:00
Martin von Zweigbergk
513d50de92 cli: if bookmark list includes conflicts, hint how to resolve them
When `jj status` reports conflicted bookmarks, it suggests running `jj
bookmark list` for details and `jj bookmark set` to resolve the
conflict. However, it's easy to just read the first half of the hint
and run `jj bookmark list` and then not know what to do. Let's remind
the user of the hint in the `jj bookmark list` output if there are
conflicted bookmarks. It should also be useful for users who run `jj
bookmark list` out of habit (not directly because `jj status`
suggested it).
2025-11-07 14:42:45 +00:00
Remo Senekowitsch
fd5accb75c cli bookmark rename: preserve tracking state
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
Now that bookmarks can be marked as tracked without a remote one
necessarily being present, we can preserve the tracking state of a
renamed bookmark.

An existing hint tells users to `jj git push --bookmark {new_bookmark}`
in order to rename the bookmark on the remote. That hint actually didn't
work before, because the `--allow-new` flag was required. Now that
tracked state is preserved, the existing hint becomes correct without
the `--allow-new` flag.
2025-11-06 07:39:57 +00:00
Martin von Zweigbergk
b409aa3189 colocation: rename from "colocated repo" to "colocated workspace"
Colocation is about sharing the working copy between jj and git. It's
less important where the repo is stored. I therefore think we should
not call it "colocated repo". I considered renaming it to "colocated
working copy" but that sounded awkward in many places because we often
talk about the whole workspace (repo + working copy), so "In colocated
workspaces with a very large number of branches or other refs" sounds
better than "In colocated working copies with a very large number of
branches or other refs".

Once we support colocate workspaces in non-main Git worktrees, I think
this rename will be even more relevant because then all those
workspaces share the same repo but only some of them may be colocated.
2025-11-03 16:53:26 +00:00
Yuya Nishihara
9aaff6afbb cli: bookmark: fix list template to accept absent-tracked remote refs 2025-10-15 01:52:19 +00:00
Yuya Nishihara
937d88ff25 cli: bookmark: allow tracking/untracking absent remote bookmarks
#7072
2025-10-15 01:52:19 +00:00
Remo Senekowitsch
991e8b8b2c cli bookmark: warn on empty implicit target revision
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-09-21 10:27:43 +00:00
Philip Metzger
6b4b2c7daf cli bookmark: un-deprecate default revset arguments
This is mostly a revert of dd73b5ab7d. It closes #5374, as feedback on
the issue has shown that many longtime and new users dislike it. Martin
himself also mentioned that he wants to walk back this deprecation.

Co-authored-by: Remo Senekowitsch <remo@buenzli.dev>
2025-09-16 17:11:38 +00:00
Yuya Nishihara
b384097caa tests: do not use "jj undo" to run multiple tests with the same setup
Since "undo" is now a high-level command, we shouldn't rely on "undo" to roll
back to a certain state.
2025-08-26 00:27:29 +00:00
Yuya Nishihara
182daa1dfa str_util: switch to globset
Since we already have globset in transitive dependencies, this change helps
reduce the amount of dependencies. Another reason is that globset provides a
function to convert glob to regex. This is nice because we use globs to match
against strings or internal repository paths instead of platform-native paths.

The GlobPattern wrapper is boxed because globset::Glob type is relatively big.
2025-07-25 08:22:35 +00:00
Remo Senekowitsch
5804bf95d0 bookmark rename: fix hint for pushing the rename
The --all flag previously also pushed deleted bookmarks. This was
changed and now --deleted is always required to push deleted bookmarks.
2025-07-09 18:37:22 +00:00
Yuya Nishihara
8adf0f6c16 templater: make CommitRef object serializable
Computed properties are removed from the serialized data. For example,
tracking ahead/behind count can be calculated by querying commits between
the target and tracking target.
2025-06-27 01:05:47 +00:00
Yuya Nishihara
183a7b6eba cli: label "working_copy" by commit_summary template, not by code
I'm thinking of adding a top-level context label consistently. If we added
"commit" to the summary template (in code), the status output would be labeled
as "working_copy commit ..", whereas log entries would be labeled as "commit
working_copy ..". The latter should be more correct since the "commit" label
is global.

Now the working-copy entry is highlighted in op log and bookmark list, which
I think is good.
2025-05-18 01:42:14 +00:00
Yuya Nishihara
f7f85383bc tests: snapshot a few more colored outputs 2025-05-18 01:42:14 +00:00
Vincent Ging Ho Yim
20fd0b7daf cli bookmark move: move names argument before --from argument
The usage line originally showed `--from <REVSETS>|NAMES`, which was confusing as it
could be parsed as `--from (<REVSETS> or NAMES)`, rather than the correct `(--from
<REVSETS>) or NAMES`.

The order of the two arguments are now swapped, so that Clap displays it as
`NAMES|--from <REVSETS>` instead. Using bookmark names as the move targets should be
more common anyway. This is also consistent with the order in which the two arguments
are described in the command's doc comment.
2025-05-16 05:06:15 +00:00
Yuya Nishihara
2d79c6431d templater: introduce newtype to format ref/remote name in revset syntax
This is the last part of the series 02722eae54 "view: port bookmark/tag name
types to RefName/RemoteName." Templater doesn't use these name types internally
because we wouldn't gain much type safety in template language.

The return type of .remote() is changed to Option<RefSymbol>. An empty symbol is
rendered with quotes, so it would be weird if local_bookmark.remote() returned
an empty RefSymbol.
2025-05-13 23:54:47 +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
Aleksey Kuznetsov
3eaff83bca cli: Add config setting for bookmark list sort order
This is a conclusion of #5849.
Config setting to list bookmarks in specified order.

Closes #3831
2025-04-08 08:06:29 +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
Aleksey Kuznetsov
3c907cc019 cli: Add --sort option to the bookmark list command
This allows different sort orders for the bookmarks list, not only
alphabetically (by name).

Relates to #3831
2025-04-02 14:46:20 +00:00
Yuya Nishihara
7d59d0564e git: use translated remote symbols in export_refs()
I also made to_git_ref_name() stricter as it seemed odd that empty tag name and
remote name were allowed.
2025-03-23 01:32:29 +00:00
Ilya Grigoriev
7d7a2fa390 cli string patterns: explain case-insensitive string prefixes
Before reading the docs, my instinct was to try `iglob:` instead of the
correct `glob-i:`.
2025-03-12 03:09:03 +00:00
Yuya Nishihara
d8ae6dc8c9 tests: port test_bookmark_command.rs to TestWorkDir API 2025-03-12 02:18:56 +00:00
Ilya Grigoriev
5eae2d92a0 tests: run insta --force-update-snapshots
This is a replacement for #5558.

Thanks to @yuja 's https://github.com/mitsuhiko/insta/pull/722, this is
now easy to generate.
2025-03-06 21:35:08 +00:00
Yuya Nishihara
b15769448b cli: provide better hint on bookmark name parse error
It should be better to say parsing failed, rather than starting with detailed
pest error message.
2025-02-28 07:27:40 +00:00
Aleksey Kuznetsov
cfcd034879 docs: Add pointers to usage of jj help -k <keyword>
Relates to #5306
2025-02-28 06:52:52 +00:00
Yuya Nishihara
7fa8420908 tests: resolve directory path to run_jj_in() relative to env_root
Suppose we'll add test_env.init_workspace(path) or something, this will probably
make sense.
2025-02-25 15:40:14 +00:00
Yuya Nishihara
ad6985fd9c tests: migrate unusual patterns of jj_cmd_ok() to run_jj_in()
These callers are manually ported to run_jj_in().
2025-02-24 15:39:11 +00:00
Yuya Nishihara
804d175fd9 tests: migrate non-snapshot users of jj_cmd_ok() to run_jj_in().success()
These callers were mostly substituted mechanically.
2025-02-24 15:39:11 +00:00
Yuya Nishihara
3193513049 tests: migrate snapshot users of jj_cmd_ok() to run_jj_in()
These callers were mostly substituted mechanically, then fixed up formatting.
2025-02-24 15:39:11 +00:00
Yuya Nishihara
255532b6b8 tests: reorder comments and snapshots, split insta::allow_duplicates! { .. }
This helps replace jj_cmd_ok() by pattern matching.
2025-02-24 15:39:11 +00:00
Yuya Nishihara
cdcc777730 tests: migrate snapshot users of jj_cmd_success() to run_jj_in()
These callers were mostly substituted mechanically, then fixed up minor
formatting and name errors.
2025-02-23 13:34:17 +00:00
Yuya Nishihara
b79b29c288 tests: migrate callers of jj_cmd_cli_error() to run_jj_in() 2025-02-23 03:06:59 +00:00
Yuya Nishihara
d19e58f591 tests: migrate callers of jj_cmd_failure() to run_jj_in() 2025-02-23 03:06:59 +00:00
Yuya Nishihara
679a5c567a tests: migrate some jj_cmd_ok() output wrappers to run_jj_in()
Some of the wrapper functions are deduplicated as we can now handle success
and failure cases in the same way.
2025-02-22 01:23:04 +00:00
Yuya Nishihara
f1cd3a4e53 tests: migrate some jj_cmd_success() output wrappers to run_jj_in() 2025-02-22 01:23:04 +00:00
Yuya Nishihara
6308897a23 cli: mention revsets doc on syntax error
Maybe we can show more specific hints on certain cases, but this should be good
as a fallback. The message is copied from the FilesetParseError hint.
2025-02-20 08:05:20 +00:00