ok/jj
1
0
Fork 0
forked from mirrors/jj
Commit graph

1691 commits

Author SHA1 Message Date
Yuya Nishihara
5c52b4e819 revset: introduce wrapper struct to pass around workspace information
More workspace-derived parameters will be added, and I don't think wrapping
with Option for each makes sense because all parameters should be available
if workspace exists.
2022-10-24 01:48:00 +09:00
Yuya Nishihara
efb8c5e58a revset: make filter_by_diff() accept either borrowed or owned matcher
So filter_by_diff() can also be used to evaluate file() revset.

I've never seen Borrow<T> for this sort of abstraction, but it seems a valid
use case of Borrow<T>.

https://stackoverflow.com/a/69318514
https://github.com/rust-lang/rust/blob/1.64.0/compiler/rustc_mir_dataflow/src/framework/cursor.rs#L45
2022-10-24 01:48:00 +09:00
Yuya Nishihara
0e1f098376 cli: add WorkspaceCommandHelper::evaluate_revset(expr)
I'll add more workspace-derived parameters to RevsetExpression::evaluate().
2022-10-24 01:48:00 +09:00
Yuya Nishihara
977cfd3d4a repo_path: make FsPathParseError displayable by itself
So it can be easily embedded in other error types such as RevsetError.
2022-10-24 01:48:00 +09:00
Yuya Nishihara
b885dc75f6 cli: inline repo_paths_from_values()
Unlike matcher_from_values(), this function is trivial and isn't widely
used. Let's simply do .map() and .collect().

TODO comment is relocated to matcher_from_values(). I think glob and
fileset-like stuff will be added to the matcher parser, not to the
'Path -> RepoPath' function. And it's probably implemented in lib crate.
2022-10-22 12:40:43 +09:00
Yuya Nishihara
50f327768c cli: move repo_paths|matcher_from_values() to WorkspaceCommandHelper
args.remove resolution in cmd_sparse() is reordered to accommodate with
borrow checker.
2022-10-22 12:40:43 +09:00
Yuya Nishihara
d635d02f06 cli: add WorkspaceCommandHelper::parse_file_path() for convenience
WorkspaceCommandHelper knows the context where user file pattern should
be resolved.
2022-10-22 12:40:43 +09:00
Yuya Nishihara
71ef8e74aa cli: remove now unused Ui::with_cwd() 2022-10-22 12:40:43 +09:00
Yuya Nishihara
3fe6da1b51 repo_path: migrate parse_file_path() from ui
It seems a bit invasive that RepoPath constructor processes an environment
like cwd, but we need an unmodified input string to build a readable error.
The error could be rewrapped at cli boundary, but I don't think it would
worth inserting indirection just for that.

I made s/file_path/fs_path/ change because there's already to_fs_path()
function, and "file path" in RepoPath context may be ambiguous.
2022-10-22 12:40:43 +09:00
Yuya Nishihara
689332aedd file_util: move path handling functions from ui module
We'll need this kind of functions in the library crate to parse user file
patterns.
2022-10-22 12:40:43 +09:00
Martin von Zweigbergk
756c4fedb6 docs: fix typo in Git config core.excludesFile 2022-10-21 19:04:30 -07:00
dependabot[bot]
f00560ef82 cargo: bump serde from 1.0.145 to 1.0.146
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.145 to 1.0.146.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.145...v1.0.146)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-21 10:52:36 -07:00
dependabot[bot]
ed2d3b1f68 cargo: bump assert_cmd from 2.0.4 to 2.0.5
Bumps [assert_cmd](https://github.com/assert-rs/assert_cmd) from 2.0.4 to 2.0.5.
- [Release notes](https://github.com/assert-rs/assert_cmd/releases)
- [Changelog](https://github.com/assert-rs/assert_cmd/blob/master/CHANGELOG.md)
- [Commits](https://github.com/assert-rs/assert_cmd/compare/v2.0.4...v2.0.5)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-21 10:52:18 -07:00
dependabot[bot]
30fce294de cargo: bump clap from 4.0.17 to 4.0.18
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.17 to 4.0.18.
- [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.17...v4.0.18)

---
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-21 10:51:49 -07:00
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