Commit graph

1677 commits

Author SHA1 Message Date
Benjamin Saunders
037eaaf36c repo: forbid checking out the root commit
Prevents `jj edit root` from succeeding, which would otherwise place
the repo in a state where every operation panics.
2022-10-21 10:10:07 -07:00
Martin von Zweigbergk
986fced69e demos: replace asciinema by screenshots
The demos don't need to be animated - the user wouldn't miss anything
if they skipped to the end. So let's just show the full output so the
user can read through it at their own pace. We could use plain text,
but I think the colors are helpful, so I went with screenshots.

Closes #166.
2022-10-21 06:04:31 -07:00
Benjamin Saunders
305cb3a7ee cli: search @- for branches to push when @ has none 2022-10-20 22:18:48 -07:00
Benjamin Saunders
b009019d8d cli: add git remote rename subcommand 2022-10-20 11:04:16 -07:00
Yuya Nishihara
bbdcd6faaf cli: apply path normalization to absolute input path, not to relative path
This patch addresses TODOs described in parse_file_path_wc_in_cwd() test.
Since the input string is considered a filesystem path, I think it makes
sense to normalize the cwd + input path first.

These utility functions will probably be moved to lib to implement file()
revset resolution.
2022-10-21 01:56:23 +09:00
Yuya Nishihara
58977f8cbf cli: simplify relative_path() by leveraging ancestors() iterator
Just code cleanup. There should be no behavior change.
2022-10-21 01:56:23 +09:00
dependabot[bot]
f3a9b06cc8 cargo: bump serde_json from 1.0.86 to 1.0.87
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.86 to 1.0.87.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.86...v1.0.87)

---
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-20 09:35:30 -07:00
Yuya Nishihara
87bcdd4e51 cli: remove redundant maybe_tty flag
It should be valid to test isatty(stdout) even if the output stream is paged.
2022-10-20 10:31:04 +09:00
Yuya Nishihara
0633856ab2 cli: remove 'dyn Write' support from Ui, use terminal output
Let the test harness suppress uninteresting output. Anyway, these tests
would print nothing.

I think Ui::with_cwd() can also be removed after refactoring file path
handling.
2022-10-20 10:31:04 +09:00
dependabot[bot]
05d19451cc cargo: bump clap_complete from 4.0.2 to 4.0.3
Bumps [clap_complete](https://github.com/clap-rs/clap) from 4.0.2 to 4.0.3.
- [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.2...clap_complete-v4.0.3)

---
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-10-19 16:27:58 -07:00
dependabot[bot]
2e0fa3a4c9 cargo: bump clap_mangen from 0.2.2 to 0.2.3
Bumps [clap_mangen](https://github.com/clap-rs/clap) from 0.2.2 to 0.2.3.
- [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.2...clap_mangen-v0.2.3)

---
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-10-19 16:11:11 -07:00
dependabot[bot]
dc2237b592 github: bump ossf/scorecard-action from 2.0.4 to 2.0.6
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.0.4 to 2.0.6.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](e363bfca00...99c53751e0)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-19 16:09:53 -07:00
Benjamin Saunders
646fc338ab Include @ in the default revset
Yields a less confusing behavior of `jj log` after pushing a commit.
2022-10-19 13:30:16 -07:00
Benjamin Saunders
d188240939 Less opinionated DynWriteLock
Allows easier reuse by future variants of UiOutputPair.
2022-10-18 22:26:13 -07:00
Benjamin Saunders
c046e1c845 Remove superfluous lifetime from Ui 2022-10-19 13:39:46 +09:00
Benjamin Saunders
0a3502453d Simplify UI test stdio 2022-10-19 13:39:46 +09:00
Martin von Zweigbergk
9f01456f84 github: move off of unmaintained actions-rs actions 2022-10-18 19:00:23 -07:00
dependabot[bot]
416f2b2a24 cargo: bump clap from 4.0.15 to 4.0.17
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.15 to 4.0.17.
- [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.15...v4.0.17)

---
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-18 09:41:36 -07:00
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