Commit Graph

1076 Commits

Author SHA1 Message Date
Waleed Khan
625f15cb3e gitignore: fix typo 2022-03-09 20:03:00 -08:00
Martin von Zweigbergk
c3b5c5e72a gitignore: add *.pending-snap created by the insta crate 2022-03-09 13:21:20 -08:00
Martin von Zweigbergk
382be623b8 docs: correct a mention about getting long vs. short help
I haven't checked, but I think `jj help git push` used to give the
short form with `clap` 2. With `clap` 3, it's definitely the long form
anyway.
2022-03-09 07:48:31 -08:00
Martin von Zweigbergk
630f8069d0 docs: explain that the there's no reason to use the native backend
A few people in different forums asked if there's any reason to use
the native backend and what the reason for its existance is, so let's
document that.
2022-03-09 07:48:31 -08:00
Martin von Zweigbergk
32e22831fc github: make CI check formatting
I've forgotten to run `rustfmt` many times (most recently in
5721436558), so let's have CI check for it.
2022-03-07 22:16:57 -08:00
Martin von Zweigbergk
3a306e6a23 cleanup: fix formatting (missed in 5721436558) 2022-03-07 22:16:57 -08:00
Martin von Zweigbergk
e0cd81cab4 github: use actions-rs/cargo instead of run
From https://github.com/actions-rs/cargo#use-cases, it sounds like
errors may be presented in a nicer way if we use `actions-rs/cargo`
instead of a simple `run`, so let's try it.
2022-03-07 22:16:57 -08:00
Martin von Zweigbergk
f112b5225c github: use minimal profile for clippy actions
We should only need the `minimal` profile. Also, we already have
configured the action to use the `clippy` component, so I don't think
we need to explicitly add it with a separate `run` action.
2022-03-07 22:16:57 -08:00
Martin von Zweigbergk
5721436558 tests: use insta crate where appropriate
Thanks to @arxanas for the suggestion.
2022-03-07 20:23:55 -08:00
Martin von Zweigbergk
0c1734a19d editorconfig: disable trim_trailing_whitespace due to multi-line bugs
The `trim_trailing_whitespace` config is not working well with
multi-line string literals. I've tried to work around
intellij-rust/intellij-rust#5368 twice and now I want to use the
`insta` crate so I'd need to find another workaround. Let's just
disable the config instead. I wouldn't be surprised if other editors
have similar bugs as IntelliJ.
2022-03-07 20:23:55 -08:00
Martin von Zweigbergk
891641670c tests: don't propagate environment variables to tests
We don't want variables from the developer's environment to affect
tests. You can make tests fail if you set `XDG_CONFIG_HOME` such that
`$XDG_CONFIG_HOME/jj/config.toml` exists and has e.g. an email
set. The fix is to not propagate any environment variables. Thanks for
@arxanas for pointing this out in #104.

We still need to set `$HOME` to prevent configs from being read from
the process owner's home directory (because that's what
`dirs::config_dir()` seems to fall back to if `$HOME` is not set). By
the way, I suspect we'd still not immune to configs from the
developers home directory on Windows, because that doesn't seem to be
controlled by `$HOME`.
2022-03-07 20:23:55 -08:00
Martin von Zweigbergk
42252a2f00 cli: on jj init --git-repo=., use relative path to .git/
When the backing Git repo is inside the workspace (typically directly
in `.git/`), let's point to it by a relative path so the whole
workspace can be moved without breaking the link.

Closes #72.
2022-03-05 09:37:48 -08:00
Martin von Zweigbergk
bbf4ba4118 cli: on jj init --git-repo, point to Git repo's .git/
When using an internal Git repo (`jj init --git`), we make
`.jj/repo/store/git_target` point directly to the repo (which is bare
in that case). It makes sense to do the same when using an external
Git repo (`jj init --git-repo`), so the contents of
`.jj/repo/store/git_target` doesn't depend on whether the user
included the `.git/` on the CLI.
2022-03-05 09:37:48 -08:00
Martin von Zweigbergk
0c6d89581e tests: pass timestamps via env vars for reproducible hashes
This patch introduces a `JJ_TIMESTAMP` environment variable that lets
us specify the timestamp to use in tests. It also updates the tests to
use it, which means we get to simplify the tests a lot now that that
the hashes are predictable.
2022-03-05 08:48:42 -08:00
Martin von Zweigbergk
b7942ad55a tests: use another workaround for intellij-rust/intellij-rust#5368
I'm about to make these strings not be regular expressions, so I need
to get rid of the `[ ]` workaround.
2022-03-05 08:48:42 -08:00
Martin von Zweigbergk
20ff88461b cli: error out if -R is not applicable
Closes #101.
2022-03-03 16:36:13 -08:00
Martin von Zweigbergk
eed9d48bf7 cli: pass clap app around instead of creating it in multiple places
We need the app (top-level `clap::Command`) in order to check if
e.g. `-R` was passed to `jj init` (for #101), and it seems cleaner to
pass the instance around than to re-create it when needed.
2022-03-03 16:36:13 -08:00
Martin von Zweigbergk
858776d3ee cli: leverage Clap's checking for conflicting arguments
I don't know why I didn't think of doing this earlier...
2022-03-03 16:36:13 -08:00
Martin von Zweigbergk
b45bada00f cli: clarify error message when jj untrack argument is not ignored
As pointed out by @arxanas in #88, the message saying something like
"At least 'bin/.DS_Store' was added back ..." is confusing especially
when the command you ran was just `jj untrack bin/.DS_Store`. Let's
clarify the message by saying exactly how many more files there are,
and specialize the message for when there is only one file. Also
update the message to say "would be added back" instead of "was added
back" since we don't actually change anything if some files would be
added back (since 4b91ad408c).

Should we even list all the files? I'm concerned that such a list
could be very long. On the other hand, it can also be annoying to have
to run `jj untrack some/dir/` and only be told about single file to
add to the ignore patterns every time.
2022-03-02 22:43:09 -08:00
Martin von Zweigbergk
6747a6c59c cli: add test of --no-commit-working-copy
I didn't add a test in #90 because the test cases needed to be cleaned
up first. They now look a bit better, so we can add test for the
flag.
2022-03-02 22:00:24 -08:00
Martin von Zweigbergk
834349a971 tests: add helper for matching regex and capturing groups 2022-03-02 22:00:24 -08:00
Martin von Zweigbergk
711f65303c tests: use assert_cmd for e2e tests
I didn't know about `assert_cmd` when I wrote the few e2e tests we
have. Let's switch to it and remove our own similar helpers.
2022-03-02 22:00:24 -08:00
Martin von Zweigbergk
b1301fd761 tests: work around intellij-rust/intellij-rust#5368
The new `.editorconfig` tells editors to strip trailing whitespace,
but IntelliJ has a bug where it strips trailing whitespace even inside
multi-line strings. We can work around it in the cases we have because
they're regexes, so `[ ]` works as a space.
2022-03-02 22:00:24 -08:00
Martin von Zweigbergk
fbd376df43 docs: mention that libssl-dev and openssl are needed for installation
Closes #75.
2022-03-02 18:38:36 -08:00
Martin von Zweigbergk
78dadcc1ba docs: restructure installation instructions to be per platform
The only overlap between the instructions for Linux, Mac, and Windows
is the `cargo install` step, so let's instead split it up so it's easy
for the user to skip to the relevant part, especially as we add more
platform-specific instructions.

I promoted some sections to one level higher sections to try to
clarify that the initial configuration and the command-line completion
applies to all platforms.
2022-03-02 18:38:36 -08:00
Martin von Zweigbergk
59eee7e918 cli: don't print "Working copy now at:" when it's unchanged
When I recently changed the working copy to not have a commit ID
(e098c01935), I lost the check in `update_working_copy()` in
`commands.rs` that made us not print "Working copy now at: " if the
commit was unchanged. Now we always print, which is unnecessary and
confusing (it makes it seem like the commit changed even if it
didn't). Let's restore the check.
2022-03-02 13:16:10 -08:00
Cole Mickens
2a6ab8b6fc nix: add manpages, completion to output 2022-03-02 08:46:54 -08:00
Cole Mickens
8cdfc81cc2 commands: add clap_mangen support 2022-03-02 08:46:54 -08:00
Cole Mickens
e5043c2ace cargo: add clap_mangen 2022-03-02 08:46:54 -08:00
Martin von Zweigbergk
384aa95901 github: update PR template to explain expectations
I think I got the current template from Google's open-sourcing
process, but I don't care about most of it (GitHub actions already
check that tests pass, for example). Let's instead tell contributors
that they don't need to write anything at all there and that they
should describe the changes in the commit message(s) instead.
2022-03-02 08:11:31 -08:00
Martin von Zweigbergk
0f245437a8 github: put repro steps first in issue template
I agree with @unrelentingtech's comment in #54 that the steps to
reproduce should come before the expected and actual behavior. I don't
know where I got the current template from. I think it was from
Google's process for open-sourcing the project.

I also removed the version field from the template for now since I
haven't started updating it regularly yet. I should start doing that.
2022-03-01 23:25:41 -08:00
Martin von Zweigbergk
e11e373427 docs: describe how to set up completion for each shell
Setting up completion is particularly non-obvious for Zsh, so let's
provide the exact command(s) for each supported shell.

Closes #67.
2022-02-28 19:35:06 -08:00
Martin von Zweigbergk
70811669fc docs: remove $ from shell scripts for easy copy&paste 2022-02-28 19:35:06 -08:00
Martin von Zweigbergk
c59dcd76a4 cargo: upgrade clap to 3.1.0
This avoids some deprecation warnings from `cargo install` (which
picks the latest version instead of the locked version by default).
2022-02-27 13:16:02 -08:00
Martin von Zweigbergk
1978a7d038 docs: use stable Rust toolchain for installation
We don't need the nightly toolchain anymore since #70 (thanks,
@arxanas!).
2022-02-27 12:49:00 -08:00
Martin von Zweigbergk
a88865a418 cli: add an option to avoid committing the working copy
It can be useful in command prompts and scripts to be able to quickly
get e.g. the `jj status` output without spending time committing the
working copy (perhaps because some background process continuously
commits the working copy). One can already do that by passing
`--at-op=<operation ID>`, but then one needs to look up the operation
ID first. That is both extra work for the user/script and it means
there's an extra `jj op log` invocation to get the operation ID. Let's
have a global flag to make it easy and efficient to do.
2022-02-27 12:12:24 -08:00
Martin von Zweigbergk
1a0b5b9c9e docs: mention user-specific config path on different platforms
Since #85, we load the user's config from a path under
`dirs::config_dir()`. It's probably not obvious to all users where to
put the file, so let's describe that. (I didn't know where to put the
file on my Mac until I looked at the function's documentation.)
2022-02-27 11:48:45 -08:00
Martin von Zweigbergk
648cfd698c cleanup: run rustfmt 2022-02-27 10:59:28 -08:00
Matthew L Daniel
88cc9ffcbc Fix a link from 423a894 2022-02-26 00:15:53 -08:00
Cole Mickens
fbe8eb47db lib/settings: try to load from platform config_dir 2022-02-26 00:09:34 -08:00
Waleed Khan
76974a9050 build: suppress unstable_name_collisions warnings on stable
Originally, I had thought that these warnings would only potentially show up in nightly because there was a feature which exposed these functions, and we would be able to enable that feature and conditionally not define the conflicting methods. But it looks like these warnings also show up in stable. I've just suppressed each of them individually. Other options would be to rename them and just make them wrapper methods, or to disable `unstable_name_collisions` warnings at a higher scope (possibly including at the crate level).
2022-02-23 23:41:55 -08:00
Waleed Khan
38aee9f749 ci: add Clippy stable check
Currently, `main` has Clippy lint warnings on stable, but not on nightly.
2022-02-23 23:41:55 -08:00
Martin von Zweigbergk
f9298582a7
Merge pull request #71 from pingiun/remove-rust-overlay
Remove rust nightly nix overlay
2022-02-21 09:28:23 -08:00
Jelle Besseling
54a6adf47a
Remove rust nightly overlay 2022-02-21 18:14:48 +01:00
Martin von Zweigbergk
5e7f69c4e8
Merge pull request #70 from arxanas/stable-rust
Support stable Rust
2022-02-21 03:17:03 -08:00
Waleed Khan
b011805fc7 ci: use stable Rust for builds
We still use nightly Clippy to ensure that 1) it builds under nightly and 2) that we pick up any new lints.
2022-02-20 22:21:14 -08:00
Waleed Khan
9202aae8b1 build: conditionally use map_first_last feature if available 2022-02-20 22:21:14 -08:00
Waleed Khan
dd3272fe90 build: use assert_matches crate
The `assert_matches` feature is nightly-only, so use this crate as a shim.
2022-02-20 22:21:14 -08:00
Waleed Khan
75480c2bdc build: migrate diff_bench to criterion
Benchmarking is currently nightly-only, so to get `jujutsu` to build on stable, we need to use a stable benchmarking library.
2022-02-20 22:21:14 -08:00
Waleed Khan
261cd1a1c4 build: add shims for nightly feature map_first_last 2022-02-20 22:16:07 -08:00