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

6637 commits

Author SHA1 Message Date
Yuya Nishihara
d2f933eed3 commit_builder: remove unneeded &mut from .write_hidden()
Since the backend::Commit has to be cloned, .write_hidden() doesn't mutate the
self.commit object.
2024-07-25 22:39:00 +09:00
Philip Metzger
fa7f4e68c5 run: Treat jj run -j0 <command> as use all available cores
Waleed noticed this in #4021.
2024-07-24 22:13:28 +02:00
dependabot[bot]
ef0560413d cargo: bump gix-filter in the cargo-dependencies group
Bumps the cargo-dependencies group with 1 update: [gix-filter](https://github.com/Byron/gitoxide).


Updates `gix-filter` from 0.11.2 to 0.11.3
- [Release notes](https://github.com/Byron/gitoxide/releases)
- [Changelog](https://github.com/Byron/gitoxide/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Byron/gitoxide/compare/gix-filter-v0.11.2...gix-filter-v0.11.3)

---
updated-dependencies:
- dependency-name: gix-filter
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-24 18:19:23 +02:00
Yuya Nishihara
7d50ebc23e cli: commit: set up rewritten commit early
For the same reason as the previous commit.
2024-07-25 00:09:39 +09:00
Yuya Nishihara
453e4f3fcc cli: split: set up rewritten commits early
For the same reason as the cmd_describe() change. A temporary commit object
will be constructed in order to render it as a description template.
2024-07-25 00:09:39 +09:00
Yuya Nishihara
0208e60358 cli: split: make local variable names shorter 2024-07-25 00:09:39 +09:00
Yuya Nishihara
4e234c1a18 cli: split: narrow scope of temporary variables of first/second commits 2024-07-25 00:09:39 +09:00
Yuya Nishihara
d637216c16 cli: describe: start transaction and set up rewritten commit early
This will help consolidate description_template_for_*() functions and port them
to templater. This change also means the committer (and operation start)
timestamp is set earlier. I think that's good.
2024-07-25 00:09:39 +09:00
Yuya Nishihara
69bb57d1d1 cli: describe: don't unwrap read error of stdin 2024-07-25 00:09:39 +09:00
Yuya Nishihara
d328adca7b tests: use insta::assert_snapshot!() to capture description templates 2024-07-25 00:09:39 +09:00
Martin von Zweigbergk
d740f1801b conflicts: use non-legacy MergedTreeId for root commit
This is part of migrating away from legacy trees (with path-level
conflicts). I can't think of any practical impact (we already compare
the tree ids equal).
2024-07-24 14:33:05 +02:00
Martin von Zweigbergk
352ca72314 tests: make helpers create non-legacy trees
Extracted and modified from #3746 by @ilyagr.
2024-07-24 14:33:05 +02:00
Yuya Nishihara
bafb357209 git: on abandoning unreachable commits, don't count HEAD ref
This basically reverts 20eb9ecec1 "git: don't abandon HEAD commit when it
loses a branch." I think the new behavior is more consistent because the Git
HEAD is equivalent to @- in jj, so it shouldn't be considered a named ref.

Note that we've made old HEAD branch not considered at 92cfffd843 "git: on
external HEAD move, do not abandon old branch."

#4108
2024-07-24 21:22:26 +09:00
Yuya Nishihara
eb332b1d08 cli: make for_loaded_repo() callers specify whether repo/workspace are synced
It's wrong to deduce loaded_at_head from command-line arguments if the repo was
loaded at an arbitrary operation. Instead, the caller should specify whether
the working copy state is synchronized with the repo view.

I think .for_loaded_repo(ui, workspace, repo, true) would be bad for
readability, so I added separate functions. I'm not happy with the name
.for_temporary_repo(), but it seems okay for the current call sites.
2024-07-24 18:06:09 +09:00
Yuya Nishihara
d7c1b97418 cli: fix "workspace add --at-op" to set up new working copy properly
Because new workspace is created for the new operation forked from the --at-op
operation, the new working copy should be writable.
2024-07-24 18:06:09 +09:00
Yuya Nishihara
b76947c1d6 cli: error out on "init --at-op/--ignore-working-copy" or "clone --at-op"
--at-op should be invalid on repo initialization. "init --ignore-working-copy"
could be supported by using working_copy.reset(), but I don't think it's
worth the effort. If the working directory is empty, --ignore-working-copy
is meaningless, and if the directory is not empty, the user would probably
want to do snapshot at some point.
2024-07-24 18:06:09 +09:00
Yuya Nishihara
c705afa299 cli: exit with CLI error status on "op abandon --at-op"
The command option --at-op isn't supported by "op abandon", so it's rather a
CLI error.
2024-07-24 18:06:09 +09:00
Yuya Nishihara
b9e82f6e06 tests: run workspace-creation commands with --at-op or --ignore-working-copy
I'm going to fix misuse of CommandHelper::for_loaded_repo(), which expects
that the given repo respects the --at-operation option.

I don't think all of the added tests are useful, but "clone
--ignore-working-copy" might be legit as a replacement for bare repos.
2024-07-24 18:06:09 +09:00
Yuya Nishihara
3f05d065b5 cli: uncapitalize op description of "workspace add" and custom command example
That's our convention.
2024-07-24 18:06:09 +09:00
Yuya Nishihara
94a4c7b714 cargo: bump tokio to 1.39.1 as previous version is yanked
```
error[yanked]: detected yanked crate (try `cargo update -p tokio`)
    ┌─ /github/workspace/Cargo.lock:316:1
    │
316 │ tokio 1.39.0 registry+https://github.com/rust-lang/crates.io-index
    │ ------------------------------------------------------------------ yanked version
```
2024-07-24 17:54:37 +09:00
Yuya Nishihara
8fec7500c3 cli: enable fileset by default
I've tested it for months and found no problems.
2024-07-24 10:49:46 +09:00
dependabot[bot]
bf7f3d7c60 github: bump DeterminateSystems/nix-installer-action
Bumps the github-dependencies group with 1 update: [DeterminateSystems/nix-installer-action](https://github.com/determinatesystems/nix-installer-action).


Updates `DeterminateSystems/nix-installer-action` from 12 to 13
- [Release notes](https://github.com/determinatesystems/nix-installer-action/releases)
- [Commits](7993355175...ab6bcb2d5a)

---
updated-dependencies:
- dependency-name: DeterminateSystems/nix-installer-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-23 12:47:48 -05:00
dependabot[bot]
819b794d9e cargo: bump the cargo-dependencies group with 3 updates
Bumps the cargo-dependencies group with 3 updates: [clap](https://github.com/clap-rs/clap), [clap_complete](https://github.com/clap-rs/clap) and [tokio](https://github.com/tokio-rs/tokio).


Updates `clap` from 4.5.9 to 4.5.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/clap_complete-v4.5.9...v4.5.10)

Updates `clap_complete` from 4.5.8 to 4.5.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/clap_complete-v4.5.8...clap_complete-v4.5.9)

Updates `tokio` from 1.38.1 to 1.39.0
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.38.1...tokio-1.39.0)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: clap_complete
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-24 01:15:16 +08:00
Stephen Jennings
2a9fdbac52 git: add --allow-private option to push command 2024-07-23 08:45:51 -07:00
Stephen Jennings
03b6d380f5 git: add git.private-commits setting for preventing commits from being pushed
The user can define the setting `git.private-commits` as they desire. For
example:

    git.private-commits = 'description(glob:"wip:*")'

If any commits are in this revset, then the push is aborted.

If a commit would be private but already exists on the remote, then it does
not block pushes, nor do its descendents block pushes unless they are also
contained in `git.private-commits`.

Closes #3376
2024-07-23 08:45:51 -07:00
Yuya Nishihara
da221eb888 repo: load index eagerly to simplify error handling
If readonly_index() and index() returned Result, it would propagate to many
call sites. That seems bad for API ergonomics. Suppose most "repo" commands
depend on an index, I think it's okay to load index eagerly:

 - "jj config" doesn't load repo (nor index)
 - "jj workspace root" doesn't load repo (nor index)
 - some other mutation commands load index when printing commit summary
 - many other commands load index when resolving revset
2024-07-23 18:26:16 +09:00
Yuya Nishihara
626aa90610 repo: use DetachedCommitBuilder constructors
I think this makes it clear that the builder doesn't add any rewrite records
to the mut_repo.
2024-07-23 18:22:40 +09:00
Yuya Nishihara
337dcef6ee commit_builder: add public interface that writes temporary commit to store
In order to render description template, we'll need a Commit object that
represents the old state (with new tree and parents) before updating the
commit description. The added functions will help generate an intermediate
Commit object.

Alternatively, we can create an in-memory Commit object with some fake
CommitId. It should be lightweight, but might cause weird issue because the
fake id wouldn't be found in the store.

I think it's okay to write a temporary commit and rely on GC as we do for
merge trees. However, I should note that temporary commits are more likely to
be preserved as they are pinned by no-gc refs until "jj util gc".
2024-07-23 18:22:40 +09:00
Yuya Nishihara
b4bf1358a5 commit_builder: extract inner builder which isn't lifetimed by mut_repo
This allows us to construct a builder, format description template with an
intermediate commit, then write() a final commit object to the repo.

I originally considered removing mut_repo from CommitBuilder at all, but
rewriter APIs rely on that CommitBuilder has &mut_repo, and splitting them
would make call sites uglier.

The inner builder methods are based on &mut Self instead of Self, because it's
easier to wrap, and users of the inner builder will bind it to a named variable
anyway.
2024-07-23 18:22:40 +09:00
Yuya Nishihara
6516a40c19 commit_builder: extract free function that sets up signing and write commit
I'll add another write() method that doesn't consume self, which will have to
clone self.commit.
2024-07-23 18:22:40 +09:00
Yuya Nishihara
fab310f53f commit_builder: keep Store internally
I'm going to extract an inner builder that is free from &mut MutableRepo
lifetime.
2024-07-23 18:22:40 +09:00
Yuya Nishihara
49d92a0480 commit_builder: remove redundant boxing from signing fn closure 2024-07-23 18:22:40 +09:00
Yuya Nishihara
209e076bfc commit_builder: use .clone_from() to silence nightly clippy warning
It's not wrong that String::clone_from() could potentially be cheaper.
2024-07-23 18:22:40 +09:00
Julien Vincent
feceb622f1 Add hunk.nvim to list of community tools 2024-07-22 15:29:54 -06:00
dependabot[bot]
005c04e7bb cargo: bump syn from 2.0.71 to 2.0.72 in the cargo-dependencies group
Bumps the cargo-dependencies group with 1 update: [syn](https://github.com/dtolnay/syn).


Updates `syn` from 2.0.71 to 2.0.72
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.71...2.0.72)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-22 19:01:55 +02:00
Benjamin Tan
dade156859 cli: add jj operation show command 2024-07-22 19:16:42 +08:00
Benjamin Tan
a6d82cc344 cli: add jj operation diff command 2024-07-22 19:16:42 +08:00
Benjamin Tan
58a813cb18 repo: add RepoLoader::merge_operations 2024-07-22 19:16:42 +08:00
Benjamin Tan
87ea9102f0 repo: add MutableRepo::merge_index 2024-07-22 19:16:42 +08:00
Yuya Nishihara
ddc601fbf9 str_util: add regex pattern
This patch adds minimal support for the regex pattern. We might have to add
"regex-i:" for completeness, but it can be achieved by "regex:'(?i)..'".
2024-07-22 12:00:52 +09:00
Yuya Nishihara
845793a7ad str_util: remove Eq + PartialEq from StringPattern
I'm going to add regex support, and compiled Regex object isn't comparable.
2024-07-22 12:00:52 +09:00
Yuya Nishihara
5783631271 tests: use assert_matches!() to compare StringPattern 2024-07-22 12:00:52 +09:00
Scott Taylor
14d3bb85bc workspace: use cwd for printing relative path
The user probably would expect the path to be relative to their current
directory rather than the workspace root. For instance, if the user is
in a child directory and runs `jj workspace add ../../name`, then they
might be surprised if we printed "../name" instead of "../../name".
2024-07-21 14:26:18 -05:00
Yuya Nishihara
8df7857706 cli_util: add tx.commit_summary_template() and related helper functions
These functions mirror the ones in WorkspaceCommandHelper. I'm not sure if all
of them will have to be public, but parse_commit_template() might be useful in
order to implement description template.
2024-07-20 09:08:59 +09:00
Yuya Nishihara
b762dd55cd cli_util: cache IdPrefixContext by transaction wrapper
This addresses lifetime issue in the next patch, in which the context has to
be borrowed from a known location.
2024-07-20 09:08:59 +09:00
Yuya Nishihara
9d5eda107d commit_builder: inline mut_repo.write_commit()
As the doc comment says, it's called only from CommitBuilder. Let's clarify
that. I'm also planning to extract a builder that only writes to the store
(without mutably borrowing a mut_repo.) It will help implement description
template.
2024-07-20 09:06:46 +09:00
Vincent Ging Ho Yim
2e3b4b5fe3 docs: add copy tracking design doc to MkDocs
Missed in #3574.
2024-07-19 22:00:09 +02:00
dependabot[bot]
491ec3d3eb github: bump github/codeql-action in the github-dependencies group
Bumps the github-dependencies group with 1 update: [github/codeql-action](https://github.com/github/codeql-action).


Updates `github/codeql-action` from 3.25.12 to 3.25.13
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](4fa2a79536...2d790406f5)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-19 19:45:21 +02:00
Ilya Grigoriev
e2f12d91cc conflicts: switch to multi-line regex, fix minor bug
The multi-line regex will be used for other purposes soon.
2024-07-18 18:42:40 -07:00
Ilya Grigoriev
d095570718 conflicts: demo minor bug 2024-07-18 18:42:40 -07:00