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
Martin von Zweigbergk
2cf99d1e35
cargo: upgrade chrono to version 0.4.23
2022-11-14 13:18:36 -08:00
Martin von Zweigbergk
13d7594e85
changelog: fix typo ("he" instead of "the")
2022-11-14 10:12:53 -08:00
Martin von Zweigbergk
9502d84872
operations: make hostname and username configurable
...
We currently get the hostname and username from the `whoami` crate. We
do that in lib crate, without giving the caller a way to override
them. That seems wrong since it might be used in a server and
performing operations on behalf of some other user. This commit makes
the hostname and username configurable, so the calling crate can pass
them in. If they have not been passed in, we still default to the
values from the `whoami` crate.
2022-11-14 10:02:04 -08:00
dependabot[bot]
12b2218a04
cargo: bump clap from 4.0.22 to 4.0.23
...
Bumps [clap](https://github.com/clap-rs/clap ) from 4.0.22 to 4.0.23.
- [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.22...v4.0.23 )
---
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-14 09:34:40 -08:00
dependabot[bot]
4d5ec02051
cargo: bump predicates from 2.1.2 to 2.1.3
...
Bumps [predicates](https://github.com/assert-rs/predicates-rs ) from 2.1.2 to 2.1.3.
- [Release notes](https://github.com/assert-rs/predicates-rs/releases )
- [Changelog](https://github.com/assert-rs/predicates-rs/blob/master/CHANGELOG.md )
- [Commits](https://github.com/assert-rs/predicates-rs/compare/v2.1.2...v2.1.3 )
---
updated-dependencies:
- dependency-name: predicates
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-11-14 09:34:17 -08:00
dependabot[bot]
1c76ea198f
github: bump github/codeql-action from 2.1.31 to 2.1.32
...
Bumps [github/codeql-action](https://github.com/github/codeql-action ) from 2.1.31 to 2.1.32.
- [Release notes](https://github.com/github/codeql-action/releases )
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md )
- [Commits](c3b6fce4ee...4238421316
)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-11-14 09:33:48 -08:00
Martin von Zweigbergk
50ba571527
log: move commit ID off to the right
...
We have talked about showing the commit ID only for divergent changes
because it's generally easier to work with the change ID, and it's
less likely to result in a divergent change. However, it's useful to
have the commit ID available for pasting into e.g. a commit message or
the GitHub UI. To try to steer users towards using the change ID, this
commit moves the commit ID off to the right in the log output.
I put it just after the "divergent" field, because that makes it close
to how I imagine it would look if we decided to hide the commit ID
except for divergent changes. I was thinking that could be rendered as
"divergent (abc123)". So if we add config to hide the commit ID, then
it would be rendered almost the same for divergent commits (just with
the added parentheses). It would also make sense to replace the
"divergent" field by a question mark on the change ID, since change
IDs basically behave like branches. If we do that, then the placement
of the commit ID I picked in this commit does not make sense.
2022-11-14 07:49:52 -08:00
Martin von Zweigbergk
f86455a452
demos: allow running without ui.allow-init-native = true
...
We need to use the native backend here because of #27 , but we
shouldn't require the user running the script to have it in their
config.
2022-11-14 00:25:24 -08:00
Martin von Zweigbergk
31368551b7
tutorial: add a few missing "(no description set)"
2022-11-14 00:24:10 -08:00
Martin von Zweigbergk
5b10c9aa0a
local_backend: switch from Protobuf to Thrift
...
This migrates the native backend from Protobuf to Thrift since
Google's Protobuf team does let us import jj into Google's monorepo if
it uses a third-party Protobuf library.
Since the native backend is not supported, I didn't write any
migration code for it.
We can't remove `lib/src/protos/store.proto` yet, because it's also
used by the Git backend (only the `predecessors` and `change_id`
fields).
2022-11-13 21:55:41 -08:00
Martin von Zweigbergk
2ae2010007
cleanup: replace an assert!
by assert_eq!
...
As pointed out by IntelliJ.
2022-11-13 20:24:24 -08:00
Martin von Zweigbergk
4ec2092e57
templates: allow using string in if-condition; use in default template
...
Given how easy this was, I can't believe I didn't make the change
sooner.
I haven't updated the screenshots in the readme because I plan to make
some further changes to the default template. I'll update them after
those changes.
2022-11-13 20:24:24 -08:00
Martin von Zweigbergk
43cfb98f78
transaction: store full OperationMetadata
instead of parts
...
We already store the description, start time, and tags. It's easier to
store the whole struct.
2022-11-13 19:06:11 -08:00
Martin von Zweigbergk
4aa4b838b4
op_store: move logic out of OperationMetadata
...
`OperationMetadata` is a data type used in the interface. It seems
wrong for it to know where to get data from.
2022-11-13 19:06:11 -08:00
Martin von Zweigbergk
9f0ae4586b
repo: pass in OperationMetadata
to OpHeadsStore::init()
...
Just a little refactoring to prepare for being able to get the
username and hostname from config.
2022-11-13 19:06:11 -08:00
Yuya Nishihara
e0fe3ffd7d
simple_op_store: create temporary Thrift store in .jj/repo directory
...
Otherwise rename() would fail if /tmp is on different device.
2022-11-14 11:13:41 +09:00