Commit graph

1659 commits

Author SHA1 Message Date
dependabot[bot]
8789fde73f github: bump github/codeql-action from 2.1.27 to 2.1.28
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.27 to 2.1.28.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](807578363a...cc7986c02b)

---
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-10-18 09:41:19 -07:00
Martin von Zweigbergk
7bca6854a0 release: release version 0.5.1
This point of this release is just to trigger the release automation
on GitHub.
2022-10-17 22:00:29 -07:00
Martin von Zweigbergk
5db47b7ae8 github: make release build create staging directory
I think 672f9e85cb was correct in saying that we don't need the
`$staging/complete` directory, but we do seem to need the `$staging`
directory, so let's restore the code for creating that. While at it, I
also cleaned up a bit so we use the `$outdir` variable instead of
duplicating it.
2022-10-17 21:43:05 -07:00
Martin von Zweigbergk
eda79bf7d3 release: release version 0.5.0
It's been several months since the last release and a lot has
changed. Probably the biggest change is that open commits are now
disabled by default.
2022-10-17 20:25:08 -07:00
Randall Mason
f6dd25126c Add homebrew on Linux and macOS
This adds directions that will work when
https://github.com/Homebrew/homebrew-core/pull/105986 is merged.  If that is
not merged, we can create a tap and adjust these directions accordingly.
2022-10-17 19:27:12 -05:00
Ilya Grigoriev
4fed26dffd Alias -B for --allow-backwards in branch set
I find myself using this argument almost every time, but it's
long to type. At the same time, fish completion does not work well
for `--allow-backwards` for some reason (though I think an alias would
be nice regardless).
2022-10-16 22:09:00 -07:00
dependabot[bot]
9da89fcc4b cargo: bump clap from 4.0.14 to 4.0.15
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.14 to 4.0.15.
- [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.14...v4.0.15)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-15 07:34:47 -07:00
Martin von Zweigbergk
a061ac022e formatter: add a with_label() helper
There's a risk of forgetting to call `remove_label()` and I've wanted
to reduce that risk for a long time. I considered creating RAII
adapters that implement `Drop`, but I didn't like that that would
ignore errors (such as `BrokenPipe`) that can happen while emitting an
escape sequence in `remove_label()`. I would ideally have liked
Python's context managers here, but Rust doesn't have that. Instead,
we get to use closures. That works pretty well, except that we can't
return other errors than `io::Error` inside the closures. Even with
that limitation, we can use the new `with_label()` method in all but a
few cases.

We can't define the `with_label()` method directly in the trait
because `&mut self` is not a trait object, so we can't pass it on to
the closure (which expects a trait object). The solution is to use
`impl dyn Formatter` (thanks to @kupiakos for figuring that
out!). That unfortunately means that we can *only* call the function
on trait objects, so if `f` is a concrete formatter type
(e.g. `PlainTextFormatter`), then `f.with_label()` won't
compile. Since we only ever access the formatters as trait objects,
that's not really a problem, however.
2022-10-13 19:27:18 -07:00
Martin von Zweigbergk
a5f7e09cbb cli: clarify jj branch forget help
Closes #532.
2022-10-12 23:33:49 -07:00
dependabot[bot]
c292cd8cff github: bump cachix/install-nix-action from 17 to 18
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 17 to 18.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](d64e055310...daddc62a2e)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-12 08:55:40 -07:00
dependabot[bot]
f1cb1759a3 cargo: bump clap from 4.0.13 to 4.0.14
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.13 to 4.0.14.
- [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.13...v4.0.14)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-12 08:55:17 -07:00
Martin von Zweigbergk
999e31089b cli: don't snapshot when cloning Git repo
There's nothing to snapshot when we have just created an empty repo to
clone into. There are also no Git refs to import.
2022-10-12 06:22:38 -07:00
Martin von Zweigbergk
b4dc105dd7 cli: remove early return after merging operations
This simplifies the control flow by having only one return (plus the
implicit ones from `?`).
2022-10-12 06:22:38 -07:00
Martin von Zweigbergk
94501131ac cli: when merging concurrent operations, snapshot afterwards
It seems simpler to do the snapshotting after merging any concurrent
operations instead of snapshotting on top of one of the operations,
especially since the attempt to snapshot may end up noticing that the
working copy is stale.

More importantly, snapshotting before resolving operations resulted in
a crash if the working copy was modified. That happened because we
held a lock on the operation heads (`locked_op_heads`) while we tried
to record the operation committing the working copy. I noticed this
only after adding the test.
2022-10-12 06:22:38 -07:00
Martin von Zweigbergk
34c24ae035 cli: move call to snapshot() out of for_loaded_repo()
We don't always want to do the snapshotting etc. right away, so let's
have the callers decide when to do it. This is just a refactoring;
I'll change the behavior slightly in separate commits.
2022-10-12 06:22:38 -07:00
Martin von Zweigbergk
94a91d9864 cli: inline WorkspaceCommandHelper::for_loaded_repo() 2022-10-12 06:22:38 -07:00
Martin von Zweigbergk
5ab74ebd5f cli: extract function for snapshotting and importing Git refs
This patch moves most of the remainder of
`WorkspaceCommandHelper::for_loaded_repo()` into a new function. We'll
inline `WorkspaceCommandHelper::for_loaded_repo()` next.
2022-10-12 06:22:38 -07:00
Martin von Zweigbergk
23910f65eb cli: don't snapshot when adding workspace
When we have just created a new workspace, there's no need to snapshot
the working copy and import Git refs, so use the new constructor
there.
2022-10-12 06:22:38 -07:00
Martin von Zweigbergk
8780f86435 cli: add non-snapshotting constructor for WorkspaceCommandHelper
`WorkspaceCommandHelper::for_loaded_repo()` creates a new instance,
imports Git refs (if using the Git backend), and snapshots the working
copy. This patch adds a new constructor function that only does the
first step. I think we'll want that functionality when we add a
command for updating a stale working copy (instead of doing it
automatically as we currently do).
2022-10-12 06:22:38 -07:00
dependabot[bot]
8e9770b8c5 cargo: bump clap from 4.0.11 to 4.0.13
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.11 to 4.0.13.
- [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.11...v4.0.13)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-11 21:57:56 -07:00
dependabot[bot]
fe1123c671 cargo: bump clap from 4.0.10 to 4.0.11
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.10 to 4.0.11.
- [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.10...v4.0.11)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-10 11:03:15 -07:00
dependabot[bot]
45e2f38bba cargo: bump serde_json from 1.0.85 to 1.0.86
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.85 to 1.0.86.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.85...v1.0.86)

---
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-10-10 10:56:04 -07:00
dependabot[bot]
7784be4200 cargo: bump uuid from 1.1.2 to 1.2.1
Bumps [uuid](https://github.com/uuid-rs/uuid) from 1.1.2 to 1.2.1.
- [Release notes](https://github.com/uuid-rs/uuid/releases)
- [Commits](https://github.com/uuid-rs/uuid/compare/1.1.2...1.2.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-10 10:55:45 -07:00
Martin von Zweigbergk
5fa21b612c cli: remind the user to configure their name and email
This commit adds a reminder in `finish_transaction()` if the user
hasn't configured their name and email. That means they'll get a
reminder after most mutating commits, except for commands that only
snapshot the working copy, and a few more cases.

Closes #530.
2022-10-09 21:24:05 -07:00
Martin von Zweigbergk
f356578b5b cli: clarify that the "first" commit created by split is the parent
This came up in discussion #620.
2022-10-09 19:56:38 -07:00
Martin von Zweigbergk
6526b76ef0 cleanup: move default() functions to impl Default
As suggested by a newer version of Clippy.
2022-10-09 12:20:15 -07:00
Martin von Zweigbergk
e11540162a graphlog: use usize::from(:bool) to convert boolean to integer
As suggested by a newer Clippy version.
2022-10-09 12:20:15 -07:00
Martin von Zweigbergk
d8c8283782 revset: wrap pest error in a Box, to keep type small
A newer version of Clippy starts complianing that the type is too
large (>=184 bytes) otherwise.
2022-10-09 12:20:15 -07:00
Martin von Zweigbergk
af4d183c7e cleanup: automated fixes by new Clippy version 2022-10-09 12:20:15 -07:00
Martin von Zweigbergk
043d118f1f cli: disallow initializing repo with native backend by default
The native backend is just a proof of concept and there's no real
reason to use it other than for testing, so let's reduce the risk of
accidentally creating repos using it.
2022-10-09 01:00:03 -07:00
Yuya Nishihara
832457d4a5 cli: fix --color=auto to not test isatty() unless initialized for terminal
No behavior change since ui here is always initialized for_terminal().
2022-10-09 09:08:46 +09:00
Yuya Nishihara
6a126bc033 cli: leverage Stdout/errLock in place of Mutex<Box<dyn Write>>
Since stdout/stderr has its own locking mechanism, we don't need yet
another Mutex.
2022-10-09 09:08:46 +09:00
Yuya Nishihara
536cab4cd7 cli: bypass stdout_formatter() for simple write calls 2022-10-09 09:08:46 +09:00
Yuya Nishihara
cb53ccbe5c cli: store bare output streams in ui, create formatter per request
This allows us to reconfigure the formatter without reinitializing the
underlying streams.
2022-10-09 09:08:46 +09:00
Yuya Nishihara
7e83b30d8e cli: remove useless Box wrapper from buffered formatter 2022-10-09 09:08:46 +09:00
Yuya Nishihara
3392e83486 cli: do not abstract away underlying output stream at formatter layer
Since the concrete Formatter type is hidden behind the Ui, there wouldn't
be many reasons to use dyn Write at the formatter layer. This allows us
to create a formatter against MutexGuard<Box<dyn Write>> without one more
Box<dyn Write> wrapper.
2022-10-09 09:08:46 +09:00
Yuya Nishihara
885f1d04d1 cli: introduce FormatterFactory to cache color table
This should help to create a temporary ColorFormatter instantly.

A cached_colors table could also be shared across formatters, but doing that
would require some locking mechanism. Since commands like cmd_log/diff()
use a single formatter instance, I don't think shared mutable cache would be
needed for the moment.
2022-10-09 09:08:46 +09:00
dependabot[bot]
c1d5a90156 github: bump github/codeql-action from 2.1.26 to 2.1.27
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.26 to 2.1.27.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](e0e5ded33c...807578363a)

---
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-10-07 09:30:19 -07:00
Yuya Nishihara
56191610c7 cli: pass formatter label by reference
All callers do String::from(), .to_string(), or .clone(), but owned label
isn't needed unless formatter is a ColorFormatter.
2022-10-08 00:52:33 +09:00
Yuya Nishihara
a1a93682cb cli: keep and reuse formatter instance at call site 2022-10-08 00:52:33 +09:00
Yuya Nishihara
97f37526e7 cli: extract write_commit_summary() as utility function
This allows callers to instantiate long-lived formatter. ui.write() can't
be invoked while formatter is borrowed. My plan is to make Ui directly hold
output streams so the color settings can be easily reset.
ui.stdout/stderr_formatter() will create a temporary formatter there.

write_commit_summary() could be hosted by WorkspaceCommandHelper to eliminate
some of the function arguments, but that would make the source RepoRef unclear
while transaction is in progress.
2022-10-08 00:52:33 +09:00
dependabot[bot]
f250a52a72 cargo: bump clap from 4.0.9 to 4.0.10
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.9 to 4.0.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/v4.0.9...v4.0.10)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-06 09:19:03 -07:00
Yuya Nishihara
45c4734b52 revset: fix parsing of concatenated-identifier in expression
Previously an expression 'foo-bar-' failed to parse because

 1. try first rule: 'foo-bar-' matches (identifier_part+ ~ '-')+, but the
    trailing '' doesn't match identifier_part+
 2. fall back to second rule: 'foo' matches identifier_part+
    => (identifier 'foo')

Instead, we need to consume as much (identifier_part ~ '-' ~ ...) as possible
before falling back to the identifier_part rule.

I think the trailing + of identifier_part+ is redundant, so removed it as
well.
2022-10-06 21:56:41 +09:00
Martin von Zweigbergk
18c0b97d9d cli: remove jj bench commands
I haven't used these in a long time. Not including it reduces the
binary size from 16.8 MB to 15.1 MiB.
2022-10-05 22:12:12 -07:00
Martin von Zweigbergk
43f0cddb1c cargo: enable only config crate's toml feature
I had intended for the `features = ["toml"]` to enable *only* the
`toml` feature, but I forgot to disable the default features so it had
no effect. This shrinks the binary from 17.4 MiB to 16.8 MiB.
2022-10-05 22:12:12 -07:00
dependabot[bot]
0cfa6f435a cargo: bump clap from 4.0.8 to 4.0.9
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.8 to 4.0.9.
- [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.8...v4.0.9)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 22:49:57 -07:00
dependabot[bot]
1e35a5eeee cargo: bump pest_derive from 2.3.1 to 2.4.0
Bumps [pest_derive](https://github.com/pest-parser/pest) from 2.3.1 to 2.4.0.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.3.1...v2.4.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-10-04 22:49:29 -07:00
dependabot[bot]
02ccbaa86e github: bump actions/checkout from 3.0.2 to 3.1.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.0.2 to 3.1.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](2541b1294d...93ea575cb5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 22:49:04 -07:00
Yuya Nishihara
f5d0419384 working_copy: return {operation_id, workspace_id} by reference
Let WorkspaceCommandHelper clone it. WorkspaceCommandHelper could return
workspace_id by reference, but doing that would introduce noisy .clone()
calls and lifetime mess.
2022-10-03 21:41:20 -07:00
Yuya Nishihara
c0c1eade91 working_copy: use OnceCell to manage {operation_id, workspace_id}
For consistency with the tree_state handling. This isn't that simple and
concise compared to the tree_state one, so I'm fine to drop the series.

I've extracted {operation_id, workspace_id} pair so these values can be
safely initialized by OnceCell. The extracted struct is named after the
"checkout" file.
2022-10-03 21:41:20 -07:00