Commit graph

5245 commits

Author SHA1 Message Date
dependabot[bot]
7ea05a69d5 cargo: bump the cargo-dependencies group with 1 update
Bumps the cargo-dependencies group with 1 update: [tempfile](https://github.com/Stebalien/tempfile).


Updates `tempfile` from 3.9.0 to 3.10.0
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Stebalien/tempfile/compare/v3.9.0...v3.10.0)

---
updated-dependencies:
- dependency-name: tempfile
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-06 08:33:23 -08:00
dependabot[bot]
64c6377ff7 github: bump the github-dependencies group with 1 update
Bumps the github-dependencies group with 1 update: [actions/upload-artifact](https://github.com/actions/upload-artifact).


Updates `actions/upload-artifact` from 4.3.0 to 4.3.1
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](26f96dfa69...5d5d22a312)

---
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-02-06 07:39:00 -08:00
Yuya Nishihara
026a72dfe7 templater: add surround(prefix, suffix, content) function
I'll probably add infix logical operators later, but the surround() function
is still useful because we don't have to repeat the condition:

    if(x || y, "<" ++ separate(" ", x, y) ++ ">")
    surround("<", ">", separate(" ", x, y))

It can't be used if we want to add placeholder text, though:

    if(x || y, "<" ++ separate(" ", x, y) ++ ">", "(none)")

Closes #2924
2024-02-06 23:39:34 +09:00
Yuya Nishihara
1adf6b5d6e cli: do initial import of Git refs without touching HEAD
This reimplements the change 9faa4670d5 "cli: on init, import git refs prior
to importing HEAD." Initialization is special because the HEAD ref isn't
available to jj yet, and there is an empty working-copy commit.

The initialization function could be refactored to go through the common code
path, but I think doing that would make future improvement harder. We might
want to initialize tracking branches based on .git/config for example.

Fixes #2942
2024-02-06 17:19:37 +09:00
Yuya Nishihara
5118d01385 cli: move is_colocated_git_workspace() to git_util, make it public 2024-02-06 17:19:37 +09:00
Ilya Grigoriev
d16a3fcda8 cli git push: new --tracked option 2024-02-05 20:26:14 -08:00
Ilya Grigoriev
cdbbde164b test_git_push: clarify the initial setup 2024-02-05 20:26:14 -08:00
Ilya Grigoriev
5037176a27 git push --help: update link to point to docs website 2024-02-05 20:26:14 -08:00
Ilya Grigoriev
5dd938bc49 config.md: link to and mention the name of "scm-diff-editor" 2024-02-05 20:04:51 -08:00
Michael Pratt
f877dfbead docs: add co-located repo hint to Gerrit question
Working with Gerrit requires directly invoking git commands, which is awkward
without a co-located repo. Add a hint to use a co-located repo.
2024-02-05 22:39:54 +01:00
dependabot[bot]
21aa765547 github: bump the github-dependencies group with 1 update
Bumps the github-dependencies group with 1 update: [EmbarkStudios/cargo-deny-action](https://github.com/embarkstudios/cargo-deny-action).


Updates `EmbarkStudios/cargo-deny-action` from 1.5.12 to 1.5.13
- [Release notes](https://github.com/embarkstudios/cargo-deny-action/releases)
- [Commits](748857f070...5def368d93)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-05 19:01:42 +00:00
dependabot[bot]
b5effc7e31 cargo: bump the cargo-dependencies group with 3 updates
Bumps the cargo-dependencies group with 3 updates: [clap_complete](https://github.com/clap-rs/clap), [pest](https://github.com/pest-parser/pest) and [pest_derive](https://github.com/pest-parser/pest).


Updates `clap_complete` from 4.4.9 to 4.4.10
- [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.4.9...clap_complete-v4.4.10)

Updates `pest` from 2.7.6 to 2.7.7
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.7.6...v2.7.7)

Updates `pest_derive` from 2.7.6 to 2.7.7
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.7.6...v2.7.7)

---
updated-dependencies:
- dependency-name: clap_complete
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-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
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-05 09:01:59 -08:00
Essien Ita Essien
2607512815 cli: add a jj git init command.
This initializes a git backed repo.

* It does the same thing as `jj init --git` except that it
  has a --colocated flag to explicitly specify that we want
  the .git repo to be side-by-side the .jj repo in the working
  directory.
* `jj init --git` will keep the current behaviour and will not
  be able to create colocated git backed repos.
* Update test snapshots.
2024-02-05 00:40:58 +00:00
Ilya Grigoriev
65e702aded cli: minor updates to jj util completion
A few minor updates after 0f27152 AKA #2945

Specifically, I tried to change the help text so that it looks better as
Markdown. I also reworded the deprecation warning and added a hint.
2024-02-04 15:55:00 -08:00
jyn
0f2715203f cli: use a positional argument for jj util completion
this has two main advantages:
- it makes it clear that the shells are mutually exclusive
- it allows us to extend the command with shell-specific options in the future if necessary
as a happy accident, it also adds support for `elvish` and `powershell`.

for backwards compatibility, this also keeps the existing options as hidden flags.

i am not super happy with how the new help looks; the instructions for setting up the shell are
squished together and IMO a little harder to read. i'm open to suggestions.
2024-02-04 13:36:55 -08:00
Ilya Grigoriev
0773cefe32 FAQ: Fix typo in and edit one of the entries 2024-02-04 13:32:11 -08:00
jyn
3d1ce5b6fd document that jj util completion defaults to bash
it's somewhat confusing to me that the `--bash` flag exists at all, since it does nothing - maybe it makes sense to give a hard error? or just remove the flag?
but in any case, it seems good to document the existing behavior.
2024-02-04 12:58:17 -08:00
jyn
52f4fb1b27 don't try to diff binary files
previously, `jj diff` would show the full contents of binary files such as images.
after this change, it instead shows "(binary)". it still shows the filename and metadata so that
users can open the file in the viewer of their choce.

future work could involve showing binary files as Sixel or similar; finding a way to compare large
non-binary files without filling up the screen; or extending the data backends to avoid having to
read the whole file contents into memory.
2024-02-04 11:49:52 -08:00
Ilya Grigoriev
d7bbbd1c29 cli git push: change warning if default revset contains no branches
Previously, `jj git push; jj git push` would tell the user that "No
branches point to the specified revisions.". I found this confusing,
even though strictly speaking it is correct (as the default revset only
considers revisions that haven't been pushed to the remote).

Closes #2241
2024-02-04 10:15:27 -08:00
Ilya Grigoriev
64fa84746a docs CLI reference: add a warning that it is experimental
There are many minor bugs that are difficult to fix in the short-term.

See also the commit message for a197409b2b
2024-02-04 10:05:47 -08:00
Ikko Eltociear Ashimine
96efc1224f docs: update README.md
minor fix.
2024-02-04 10:12:48 -06:00
Yuya Nishihara
99f0e7f844 cli: remove workaround for ": {source}" embedded in error message 2024-02-04 09:13:21 +09:00
Yuya Nishihara
77ceadbfd0 cleanup: remove remaining ": {source}" from error message templates 2024-02-04 09:13:21 +09:00
Yuya Nishihara
1efadd96c8 git: remove ": {source}" from FailedRefExportReason, walk chain by caller
The error output gets more verbose because all gix error sources are printed.
Maybe we'll need a better formatting, but changing to multi-line output doesn't
look nice either.
2024-02-04 09:13:21 +09:00
Yuya Nishihara
a0cefb8b7b revset, template: remove ": {source}" from parse error message template
These error types are special because the message is embedded in ASCII art. I
think it would be a source of bugs if some error types had ": {source}" but
others don't. So I'm going to remove all ": {source}"s, and let the callers
concatenate them when needed.
2024-02-04 09:13:21 +09:00
Ilya Grigoriev
d439de073d rewrite.rs: revert commits cfcc7c5e and becbc889
This mostly reverts https://github.com/martinvonz/jj/pull/2901 as well as its
fixup https://github.com/martinvonz/jj/pull/2903. The related bug is reopened,
see https://github.com/martinvonz/jj/issues/2869#issuecomment-1920367932.

The problem is that while the fix did fix #2869 in most cases, it did
reintroduce the more severe bug https://github.com/martinvonz/jj/issues/2760
in one case, if the working copy is the commit being rebased.

For example, suppose you have the tree

```
root -> A -> B -> @ (empty) -> C
```

### Before this commit

#### Case 1

`jj rebase -s B -d root --skip-empty` would work perfectly before this
commit, resulting in

```
root -> A
  \-------B -> C
           \- @ (new, empty)
```

#### Case 2

Unfortunately, if you run `jj rebase -s @ -d A --skip-empty`, you'd have the
following result (before this commit), which shows the reintroduction of #2760:

```
root -> A @ -> C
         \-- B
```

with the working copy at `A`. The reason for this is explained in
https://github.com/martinvonz/jj/pull/2901#issuecomment-1920043560.

### After this commit

After this commit, both case 1 and case 2 will be wrong in the sense of #2869,
but it will no longer exhibit the worse bug #2760 in the second case.

Case 1 would result in:

```
root -> A
  \-------B -> @ (empty) -> C
```

Case 2 would result in:

```
root -> A -> @ -> C
         \-- B
```

with the working copy remaining a descendant of A
2024-02-03 15:56:44 -08:00
Austin Seipp
f775a30cfa docs: update changelog with checkout/merge deprecations
Summary: Put both notices together at once, for ease of reading and
understanding.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: I2aedb42fdab346b21990a106433512d7ec119ad4
2024-02-03 17:21:56 -06:00
Austin Seipp
7a7f76cbfb cli: deprecate jj merge
Summary: As discussed in Discord, on GitHub, and elsewhere, this change
deprecates the use of `jj merge` and suggests users use `jj new` exclusively
instead. `merge` isn't completely unfit as a name; but we think it obscures
the generality of `new` and we want people to use it instead.

To further drive the bit home, by default, `jj merge` is now hidden. This will
hopefully stop new users from running into it.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: I94938aca9d3e2aa12d1394a5fbc58acce3185b56
2024-02-03 17:21:56 -06:00
Austin Seipp
3f13ea39e2 cli: deprecate jj checkout
Summary: As discussed in Discord, on GitHub, and elsewhere, this change
deprecates the use of `jj checkout` and suggests users use `jj new` exclusively
instead. The verb `checkout` is a relic of a bygone era the — days of RCS
file locking, before 3-way merge — and is not a good, fitting name for the
functionality it provides.

To further drive the bit home, by default, `jj checkout` (and `jj co`) is now
hidden. This will hopefully stop new users from running into it.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: I7a1adfc9168fce1f25cf5d4c4c313304769e41a1
2024-02-03 17:21:56 -06:00
Austin Seipp
2a9e6fc610 cli: move tests from test_checkout -> test_new_command
These didn't really need to use `jj checkout`, and it will be deprecated in a
future change anyway. Move them out of there and into `new`.

Ideally this would go into `test_conflicts.rs`, but that exists in `jj-lib`, so
it doesn't have `TestEnvironment` available to it.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: If0173b27ab4d1f6036a4ec632ec77b6824f310c3
2024-02-03 17:21:56 -06:00
Benjamin Brittain
ae3404cdf2 chore: Bump yanked iana-time-zone crate 2024-02-03 15:22:07 -05:00
Essien Ita Essien
bcdb9beb6c cli: Move git_init() from init.rs to git.rs
* Move git_init() to cli/src/commands/git.rs and call it from there.
* Move print_trackable_remote_branches into cli_util since it's not git specific,
  but would apply to any backend that supports remote branches.
* A no-op change. A follow up PR will make use of this.
2024-02-03 15:06:09 +00:00
Essien Ita Essien
31e4061bab cli: Refactor out git_init() to encapsulate all git related work.
* Create a git_init() function in cli/src/commands/init.rs where all git related work is done.
  This function will be moved to cli/src/commands/git.rs in a subsequent PR.
2024-02-03 14:27:12 +00:00
Essien Ita Essien
8423c63a04 cli: Refactor workspace root directory creation
* Add file_util::create_or_reuse_dir() which is needed by all init
  functionality regardless of the backend.
2024-02-03 14:15:05 +00:00
Ilya Grigoriev
b3c47953e8 config.md docs: document jj config edit and jj config path
This changes the intro section to recommend using `jj config edit` to
edit the config instead of looking for the files manually.
2024-02-02 23:29:58 -08:00
Ilya Grigoriev
e9c482c017 docs: mention in jj help config edit that the command can create a file 2024-02-02 23:29:58 -08:00
Ilya Grigoriev
98948554f7 cli jj config: add jj config path command 2024-02-02 23:29:58 -08:00
Ilya Grigoriev
8a4b3966a6 test_global_opts: make test_version just a bit nicer when it fails 2024-02-02 23:19:25 -08:00
Ilya Grigoriev
42e6132771 test_global_opts: extract --version to its own test 2024-02-02 23:19:25 -08:00
dependabot[bot]
42c85b33c7 cargo: bump the cargo-dependencies group with 1 update
Bumps the cargo-dependencies group with 1 update: [tokio](https://github.com/tokio-rs/tokio).


Updates `tokio` from 1.35.1 to 1.36.0
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.35.1...tokio-1.36.0)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-02 11:36:20 -06:00
dependabot[bot]
32c6406e5f github: bump the github-dependencies group with 1 update
Bumps the github-dependencies group with 1 update: [DeterminateSystems/magic-nix-cache-action](https://github.com/determinatesystems/magic-nix-cache-action).


Updates `DeterminateSystems/magic-nix-cache-action` from 1402a2dd8f56a6a6306c015089c5086f5e1ca3ef to eeabdb06718ac63a7021c6132129679a8e22d0c7
- [Release notes](https://github.com/determinatesystems/magic-nix-cache-action/releases)
- [Commits](1402a2dd8f...eeabdb0671)

---
updated-dependencies:
- dependency-name: DeterminateSystems/magic-nix-cache-action
  dependency-type: direct:production
  dependency-group: github-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-02 11:36:07 -06:00
Daniel Ploch
01825953ac sparse-v2: design doc proposition for Sparse Patterns refactoring
Kicks off work on issue #1896
2024-02-01 16:02:14 -08:00
Yuya Nishihara
28dd0180ad cli: propagate WorkspaceLoadError::Path error transparently
The inner error message is now printed by default.
2024-02-02 08:22:24 +09:00
Yuya Nishihara
9adf6e1303 cli: remove "I/O error" prefix from the error message
It doesn't add much context, and looks worse with the new error formatting.
2024-02-02 08:22:24 +09:00
Yuya Nishihara
30666dfbcf cli: preserve source of user error, print source chain one by one
"Caused by" lines are inserted before the hint because they are more strongly
related to the error.
2024-02-02 08:22:24 +09:00
dependabot[bot]
fb6c834f59 cargo: bump the cargo-dependencies group with 3 updates
Bumps the cargo-dependencies group with 3 updates: [indexmap](https://github.com/indexmap-rs/indexmap), [libc](https://github.com/rust-lang/libc) and [rustix](https://github.com/bytecodealliance/rustix).


Updates `indexmap` from 2.2.1 to 2.2.2
- [Changelog](https://github.com/indexmap-rs/indexmap/blob/master/RELEASES.md)
- [Commits](https://github.com/indexmap-rs/indexmap/compare/2.2.1...2.2.2)

Updates `libc` from 0.2.152 to 0.2.153
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.152...0.2.153)

Updates `rustix` from 0.38.30 to 0.38.31
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.30...v0.38.31)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-01 08:56:08 -08:00
Yuya Nishihara
526953cd87 cli: print "workspace root" without loading repo 2024-02-02 01:28:23 +09:00
Yuya Nishihara
818a885658 cli: map bare BackendError to internal error
The error message suggests that BackendError isn't a user error.
2024-02-01 16:59:44 +09:00
Yuya Nishihara
ca322b761a cli: print source chain of internal error in a similar way to anyhow
Multi-line output should be easier to follow than lengthy line separated by
colon.
2024-02-01 16:59:44 +09:00
Yuya Nishihara
a278059c64 cli: preserve source object of internal error
I'm going to rewrite the error output to print source chain one by one.

The "{message}: {err}" pattern is wrapped in an error struct. InternalError
variant could be a { message, source } pair, but not all errors need an
additional message. This will also apply to UserError.
2024-02-01 16:59:44 +09:00