Commit graph

1891 commits

Author SHA1 Message Date
Martin von Zweigbergk
2a87815006 cleanup: remove a few unnecessary borrows, as reported by Clippy 2022-11-26 06:05:29 -10:00
Ruben Slabbert
84b924946f feature: add verbose logging for clone/fetch command 2022-11-26 10:58:00 +10:00
dependabot[bot]
f372b04395 cargo: bump clap_complete from 4.0.5 to 4.0.6
Bumps [clap_complete](https://github.com/clap-rs/clap) from 4.0.5 to 4.0.6.
- [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.0.5...clap_complete-v4.0.6)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-25 06:30:32 -10:00
dependabot[bot]
02f91884a8 cargo: bump clap from 4.0.26 to 4.0.27
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.26 to 4.0.27.
- [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.0.26...v4.0.27)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-25 06:10:07 -10:00
dependabot[bot]
68e9559caa cargo: bump pest_derive from 2.4.1 to 2.5.0
Bumps [pest_derive](https://github.com/pest-parser/pest) from 2.4.1 to 2.5.0.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.4.1...v2.5.0)

---
updated-dependencies:
- dependency-name: pest_derive
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-25 06:09:37 -10:00
dependabot[bot]
d3f8951da0 cargo: bump clap_mangen from 0.2.4 to 0.2.5
Bumps [clap_mangen](https://github.com/clap-rs/clap) from 0.2.4 to 0.2.5.
- [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_mangen-v0.2.4...clap_mangen-v0.2.5)

---
updated-dependencies:
- dependency-name: clap_mangen
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-25 06:08:23 -10:00
Ilya Grigoriev
092aca46c0 Test split commit message
In particular, tests functionality from cf3b6ee2
2022-11-24 20:29:17 -08:00
Ilya Grigoriev
f4b175a86d Make fake-editor and fake-diff-editor error output more verbose 2022-11-24 20:29:17 -08:00
Ilya Grigoriev
2150166652 Add next invocation command to fake-editor
This adds a `next invocation` command to `fake-editor` that ignores the
rest of the script for *this* invocation, but overwrites the script
with whatever follows `next invocation`.

This is useful to test commands that invoke `fake-editor` several times,
especially the `jj split` command.
2022-11-24 20:29:17 -08:00
Ilya Grigoriev
0b528eb587 Fix some cargo +nightly clippy warnings 2022-11-24 20:29:17 -08:00
Yuya Nishihara
ce3397c2cb revset: combine operator parsing steps
I'm thinking of adding alias expansion at this stage, and it would be a bit
tedious to pass around mutable context by function parameter. So let's reduce
the number of the intermediate functions.

This also produces a better error message.
2022-11-25 11:01:15 +09:00
Yuya Nishihara
78e34d2f81 revset: migrate operator parsing to PrattParser 2022-11-25 11:01:15 +09:00
Yuya Nishihara
5491b5581f revset: decouple prefix/infix/postfix range operators
This unblocks the use of PrattParser, which builds an operator map keyed
solely by Rule, not by (Rule, prefix/infix/postfix) pair.
2022-11-25 11:01:15 +09:00
Yuya Nishihara
f8aa6b1deb revset: simplify range expression rule by grouping operators 2022-11-25 11:01:15 +09:00
Martin von Zweigbergk
37e30a4b68 tests: use snapshot testing for operation log
The operation IDs are now predictable in tests.
2022-11-24 16:00:20 -10:00
Martin von Zweigbergk
56f94e5192 cli: record program name in operation metadata as exactly "jj"
This is a simple workaround to make operation IDs predictable (so they
don't include the path to `.../target/debug/jj` or similar). The full
path can probably be useful for troubleshooting, but we can deal with
that later if we see a need for it. It might also be less confusing
for Windows users if it says "jj.exe".
2022-11-24 16:00:20 -10:00
Martin von Zweigbergk
802e21bf25 operations: allow overriding timestamps for tests
It would be nice to be able to use snapshot testing and not have to
parse the output of `jj op log`. This patch lets us do that by
providing a new environment variable and config for overriding the
timestamps. Unlike `operation.hostname` and `operation.username`,
these are only meant for tests.
2022-11-24 16:00:20 -10:00
Martin von Zweigbergk
7c99fa0750 diff_edit: remove unnecessary settings argument
We already get the settings via the ui object here.
2022-11-24 16:00:20 -10:00
Martin von Zweigbergk
c7b90bbe1c cli_util: make resolve_aliases() take only settings, not whole ui 2022-11-24 16:00:20 -10:00
Martin von Zweigbergk
8d7a9e729b tests: set test hostname and username for operation log
This makes the tests more hermetic, even though I don't think the
default values (taken from `whoami`) can break any tests (then we
would have already seen them break). Now we just need to make the
operation log's timestamps predictable and then we can start using
operation IDs in snapshot tests.
2022-11-24 16:00:20 -10:00
dependabot[bot]
90ce94e262 cargo: bump pest from 2.4.1 to 2.5.0
Bumps [pest](https://github.com/pest-parser/pest) from 2.4.1 to 2.5.0.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.4.1...v2.5.0)

---
updated-dependencies:
- dependency-name: pest
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-24 05:34:57 -10:00
dependabot[bot]
20c7514649 cargo: bump serde_json from 1.0.88 to 1.0.89
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.88 to 1.0.89.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.88...v1.0.89)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-23 21:45:41 -10:00
dependabot[bot]
9b25d8df63 cargo: bump zstd from 0.11.2+zstd.1.5.2 to 0.12.0+zstd.1.5.2
Bumps [zstd](https://github.com/gyscos/zstd-rs) from 0.11.2+zstd.1.5.2 to 0.12.0+zstd.1.5.2.
- [Release notes](https://github.com/gyscos/zstd-rs/releases)
- [Commits](https://github.com/gyscos/zstd-rs/commits)

---
updated-dependencies:
- dependency-name: zstd
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-23 21:29:45 -10:00
Ruben Slabbert
f0e4615e61 feature: add verbose flag and tracing library 2022-11-24 16:35:14 +10:00
Martin von Zweigbergk
3e0f6ef2b9 cli: use is_tty() from crossterm crate instead of atty
The `atty` crate seems unmaintained. There's
https://rustsec.org/advisories/RUSTSEC-2021-0145 filed against it,
which `cargo-deny` complains about. A fix for that has been open for
well over a year without being fixed
(https://github.com/softprops/atty/pull/51). It turns out the
functionality is also available via the `crossterm` crate (thanks,
@yuja), which we already depend on.

Since we also depend on `atty` via `clap`, I also added an exception
to the `cargo-deny` config.
2022-11-23 20:12:45 -10:00
Waleed Khan
94815a7cb5 log: warn if the provided path looks like a revset 2022-11-21 16:42:48 -08:00
dependabot[bot]
70182fbf7a cargo: bump bytes from 1.2.1 to 1.3.0
Bumps [bytes](https://github.com/tokio-rs/bytes) from 1.2.1 to 1.3.0.
- [Release notes](https://github.com/tokio-rs/bytes/releases)
- [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/bytes/commits)

---
updated-dependencies:
- dependency-name: bytes
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-21 06:09:15 -10:00
Yuya Nishihara
946d5c5896 tests: suppress must_use warning and update cli_error output 2022-11-21 23:14:50 +09:00
Waleed Khan
9607d954e4 tests: assert result of TestEnvironment::jj_cmd_cli_error
In the test case `test_branch_mutually_exclusive_actions`, we weren't actually testing anything useful, because the interface has since changed to use subcommands instead of options. The test has been deleted in this commit, and `TestEnvironment::jj_cmd_cli_error` has been changed to return a `#[must_use]` `String` representing stderr. I also added `#[must_use]` to `TestEnvironment::jj_cmd_failure` while I was here.
2022-11-20 05:08:35 -08:00
Yuya Nishihara
6d500ed66c cli: fix crash by "jj <global_opts>" without subcommand 2022-11-20 22:02:46 +09:00
Yuya Nishihara
a5297c0082 revset: add comment about subtle optimization issue regarding hidden commits
Per the discussion in #764.
2022-11-20 22:01:19 +09:00
Ruben Slabbert
68b77d123d feature: support git credential helpers 2022-11-19 22:06:27 -08:00
Yuya Nishihara
84efed420f revset: allow empty string literal "" 2022-11-20 13:11:28 +09:00
Martin von Zweigbergk
57ff990fe8 docs: describe git commit --fixup equivalent
It's probably not obvious that `jj move` can be used for the `git
commit --fixup` usecase.
2022-11-19 14:22:34 -08:00
dependabot[bot]
928da6e363 cargo: bump serde_json from 1.0.87 to 1.0.88
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.87 to 1.0.88.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.87...v1.0.88)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-18 08:21:52 -08:00
dependabot[bot]
f9f4f8b520 github: bump EmbarkStudios/cargo-deny-action from 1.3.2 to 1.4.0
Bumps [EmbarkStudios/cargo-deny-action](https://github.com/EmbarkStudios/cargo-deny-action) from 1.3.2 to 1.4.0.
- [Release notes](https://github.com/EmbarkStudios/cargo-deny-action/releases)
- [Commits](7257a18a9c...8a8607bd8e)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-17 07:57:43 -08:00
dependabot[bot]
ec23c5a0be cargo: bump digest from 0.10.5 to 0.10.6
Bumps [digest](https://github.com/RustCrypto/traits) from 0.10.5 to 0.10.6.
- [Release notes](https://github.com/RustCrypto/traits/releases)
- [Commits](https://github.com/RustCrypto/traits/compare/digest-v0.10.5...digest-v0.10.6)

---
updated-dependencies:
- dependency-name: digest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-17 07:57:06 -08:00
dependabot[bot]
a072c6e9aa cargo: bump clap from 4.0.25 to 4.0.26
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.25 to 4.0.26.
- [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.0.25...v4.0.26)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-17 07:56:49 -08:00
dependabot[bot]
935c75849e cargo: bump clap from 4.0.24 to 4.0.25
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.24 to 4.0.25.
- [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.0.24...v4.0.25)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-16 08:24:58 -08:00
Yuya Nishihara
13bb53e839 revset: give higher precedence to intersection/difference operators
Just like hg revsets and major programming languages.
2022-11-17 01:11:08 +09:00
Yuya Nishihara
a90c9960ba revset: leverage PrattParser to parse infix (or set) expression
Apparently, this is new feature introduced in pest 2.4.0. It allows us to
easily enforce operator precedence. I think the whole expression post-parsing
can be migrated to PrattParser, but let's start small. We might want to
add a weird rule to the range_expression layer in future.

https://github.com/pest-parser/pest/releases/tag/v2.4.0
https://docs.rs/pest/latest/pest/pratt_parser/struct.PrattParser.html#example
2022-11-17 01:11:08 +09:00
Yuya Nishihara
1717690a64 revset: leverage SOI/EOI markers to detect incomplete parser input
The error message is still a bit cryptic, but I don't think it's worse than
the original "incomplete parse" error.

https://pest.rs/book/grammars/syntax.html#start-and-end-of-input
2022-11-17 01:11:08 +09:00
Yuya Nishihara
a81ebeb85e revset: add empty() predicate to find commits with no file change
The expression 'x ~ empty()' is identical to 'x & file(".")', but more
intuitive.

Note that 'x ~ empty()' is slower than 'x & file(".")' since the negative
intersection isn't optimized right now. I think that can be handled as
follows: 'x ~ filter(f)' -> 'x & filter(!f)' -> 'filter(!f, x)'
2022-11-16 08:50:33 +09:00
Yuya Nishihara
230ac043ff revset: extract helper function that tests diff from parent revision 2022-11-16 08:50:33 +09:00
Yuya Nishihara
c7145a2ed9 revset: unify constructors of RevsetExpression::Filter
Since filter predicates no longer take an optional candidates argument,
these .with_<predicate>() constructors aren't useful anymore.
2022-11-16 08:50:33 +09:00
Yuya Nishihara
19a3fb7d6c revset: flatten match arms of description|author|committer predicates
Since most of the code duplicates has been extracted to helper functions,
nested match statement looks more verbose.
2022-11-16 08:50:33 +09:00
dependabot[bot]
18feef3775 cargo: bump insta from 1.21.0 to 1.21.1
Bumps [insta](https://github.com/mitsuhiko/insta) from 1.21.0 to 1.21.1.
- [Release notes](https://github.com/mitsuhiko/insta/releases)
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/insta/commits/1.21.1)

---
updated-dependencies:
- dependency-name: insta
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-15 08:47:56 -08:00
dependabot[bot]
6ae6b5d1a5 cargo: bump clap from 4.0.23 to 4.0.24
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.23 to 4.0.24.
- [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.0.23...v4.0.24)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-15 08:47:38 -08:00
dependabot[bot]
7cec2afa58 cargo: bump uuid from 1.2.1 to 1.2.2
Bumps [uuid](https://github.com/uuid-rs/uuid) from 1.2.1 to 1.2.2.
- [Release notes](https://github.com/uuid-rs/uuid/releases)
- [Commits](https://github.com/uuid-rs/uuid/compare/1.2.1...1.2.2)

---
updated-dependencies:
- dependency-name: uuid
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-15 08:47:13 -08:00
Martin von Zweigbergk
780d7fb59c backend: rename NormalFile to just File
There are no "non-normal" files, so "normal" is not needed. We have
symlinks and conflicts, but they are not files, so I think just "file"
is unambiguous.

I left `testutils::write_normal_file()` because there it's used to
mean "not executable file" (there's also a `write_executable_file()`).

I left `working_copy::FileType::Normal` since renaming `Normal` there
to `File` would also suggest we should rename `FileType`, and I don't
know what would be a better name for that type.
2022-11-14 23:36:43 -08:00