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

1820 commits

Author SHA1 Message Date
Martin von Zweigbergk
2172887876 git: don't detach head if the ref already points to the right place
The first time we export to Git, we don't actually export
anything. That's a little weird and I don't know why I did it that
way. It seems more natural to export the current state. I'd like to
change it to do that. However, that currently means we'll detach the
current HEAD if it points to any of the branches we export. This patch
restructures the code a bit and skips the detach step if the target
branch already points to the right commit.
2022-11-13 15:06:10 -08:00
Martin von Zweigbergk
f3f41cc2cc git: write view object - not operation ID - to disk on export
We could write the view object to the operation store instead, but
then we would need to make sure we don't GC it (once we add support
for GC of the operation store).
2022-11-13 15:06:10 -08:00
Martin von Zweigbergk
10343876fa cli: include message from GitExportError to user
I'm going to add other error variants for when we fail to read/write
to disk, and I don't think we need to have a custom message for each
in the CLI crate. It's easier to pass along the message from the lib
crate.

(`ConflictedBranch`, on the other hand, is an expected error so I
think we should continue to let let the CLI crate define the error
message for it.)
2022-11-13 15:06:10 -08:00
Martin von Zweigbergk
80aaf6c0e0 git: pass old and new view - not full repo - into export function
In order to fix #463, I'm going to make us export to Git a little
earlier, before finishing the transation. That means we won't have an
operation yet, but we don't need that anyway.
2022-11-13 15:06:10 -08:00
Martin von Zweigbergk
979b46b006 tests: test exporting to Git after deleting a branch 2022-11-13 15:06:10 -08:00
Martin von Zweigbergk
f40c8d86a1 tests: add more tests of working copy colocated with Git
We had very little testing of the colocated case, so let's add a bit
more before I start working on this code in coming patches. This
includes a test for #463.
2022-11-13 15:06:10 -08:00
Martin von Zweigbergk
ebfe0a4823 tests: add test for export of conflicted branches
To fix #463, I think we want to skip conflicted branches when we
export instead of erroring out. It seems we didn't have test case for
the current behavior, so let's add one.
2022-11-13 15:06:10 -08:00
Martin von Zweigbergk
18a25a7c2b tests: demonstrate spurious branch conflict after git export
This is a test case for #463. It's not exactly the same case, but I'm
confident that the root cause is the same (that the
`.jj/repo/git_export_operation_id` doesn't include the git refs we
just updated).
2022-11-13 15:06:10 -08:00
Martin von Zweigbergk
ec46ae11ad tests: extract function for getting git Oid from jj Commit 2022-11-13 15:06:10 -08:00
Martin von Zweigbergk
eb89f6b6ca tests: consistently import create_random_tree()
These calls often appear in expressions long enough that not having to
qualify it means that we can sometimes avoid wrapping a line. I
noticed because IntelliJ told me that `test_git.rs` had some
unnecessary qualificiations (the function was already imported there).
2022-11-13 15:06:10 -08:00
Martin von Zweigbergk
4ee261717e simple_op_store: replace Protobuf by Thrift
As mentioned in the previous commit, we need to remove the Protobuf
dependency in order to be allowed to import jj into Google's
repo. This commit makes `SimpleOpStore` store its data using Thrift
instead of Protobufs. It also adds automatic upgrade of existing
repos. The upgrade process took 18 s in my repo, which has 22k
operations. The upgraded storage uses practically the same amount of
space. `jj op log` (the full outut) in my repo slowed down from 1.2 s
to 3.4 s. Luckily that's an uncommon operation. I couldn't measure any
difference in `jj status` (loading a single operation).
2022-11-13 11:39:33 -08:00
Martin von Zweigbergk
8acb54b26e op_store: extract current Protobuf-based implementation to separate file
In order to allow building jj inside of Google, our Protobuf team
doesn't want to us to use a Google-unsupported implementation. Since
there is no supported implementation in Rust, we have to migrate off
of Protobufs. I'm starting with the operation store. This commit moves
the current implementation to a separate file so it can easily be
disabled by a Caargo feature.
2022-11-13 11:39:33 -08:00
Benjamin Saunders
c3bfe72754 local_backend: use ContentHash rather than hashing protos
Insulates identifiers from the unstable serialized form.
2022-11-12 21:40:36 -08:00
Benjamin Saunders
2447dfeed8 simple_op_store: hash view/operation data directly
Decouples view/operation IDs from serialized forms, which are not
necessarily stable. Not breaking as these IDs are persistent, never
recomputed or used for integrity checking.
2022-11-12 21:40:36 -08:00
Martin von Zweigbergk
92f6571b31 cli: use "hint" style for hint about using --git-repo=. 2022-11-12 17:58:22 -08:00
Martin von Zweigbergk
7ce8138794 cli: use separate hint for errors from jj branch 2022-11-12 17:58:22 -08:00
Martin von Zweigbergk
698bba387f cli: separate out hint in untrack message 2022-11-12 17:58:22 -08:00
Martin von Zweigbergk
6a15cc02bf cli: print hints using "hint" style, not "error" style
Several lines of red text can be overwhelming, and makes it harder to
tell the hint from the error. Let's separate the hint from the error
instead. This matches what hg does. Having the hints separated out
also means that we could have a single config to turn them off.
2022-11-12 17:58:22 -08:00
Martin von Zweigbergk
2a17bb76e9 cli: add factory function for CommandError::UserError
I want to add a separate field for a hint, so that can be printed in a
different color (than red). Having a factory function is useful then,
since most call sites don't want to pass a hint. Also, by using a
factory function instead of using the constructor directly means that
we can accept `&str` arguments instead of forcing the caller to
convert a string literal to `String`.
2022-11-12 17:58:22 -08:00
Yuya Nishihara
eb790760a2 repo: simplify unsafe cast of view reference 2022-11-12 01:03:48 +09:00
Yuya Nishihara
2c042cee75 repo: extract unsafe view handling bits to separate struct
This should help us reason about the safety implication. New inner module
is added to encapsulate unsafe access.

DirtyCell provides .with_ref(callback) instead of .borrow(). This isn't
strictly needed, but should clarify the intent of the temporary reference.
This also allows us to rewrite DirtyCell without unsafe code, if needed,
by leveraging OnceCell<T> x RefCell<Option<T>> pair.
2022-11-12 01:03:48 +09:00
dependabot[bot]
3e77fcdafa github: bump dtolnay/rust-toolchain
Bumps [dtolnay/rust-toolchain](https://github.com/dtolnay/rust-toolchain) from ba37adf8f94a7d9affce79bd3baff1b9e3189c33 to 55c7845fad90d0ae8b2e83715cb900e5e861e8cb.
- [Release notes](https://github.com/dtolnay/rust-toolchain/releases)
- [Commits](ba37adf8f9...55c7845fad)

---
updated-dependencies:
- dependency-name: dtolnay/rust-toolchain
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-11 07:30:54 -08:00
dependabot[bot]
5170b54ac7 cargo: bump blake2 from 0.10.4 to 0.10.5
Bumps [blake2](https://github.com/RustCrypto/hashes) from 0.10.4 to 0.10.5.
- [Release notes](https://github.com/RustCrypto/hashes/releases)
- [Commits](https://github.com/RustCrypto/hashes/compare/blake2-v0.10.4...blake2-v0.10.5)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-11 21:50:49 +09:00
Martin von Zweigbergk
6c600e98cf templater: indicate if branch needs to be pushed to a remote
It's useful to know when you've modified a branch that exists on a
remote. A typical case is when you have pushed a branch to a remote
and then rewritten it. This commit adds an indication in the
`branches` template keyword. A branch that needs to be pushed to a
remote now has a `*` at the end (similar to how conflicted branches
have a `?` at the end). Note that the indication only considers
remotes where the branch currently exists, so there won't be an
indication that the branch has not been pushed to a remote.

Closes #254
2022-11-09 22:44:55 -08:00
dependabot[bot]
5e710bac66 cargo: bump pest_derive from 2.4.0 to 2.4.1
Bumps [pest_derive](https://github.com/pest-parser/pest) from 2.4.0 to 2.4.1.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.4.0...v2.4.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-09 08:45:54 -08:00
dependabot[bot]
c08dbd222e cargo: bump assert_cmd from 2.0.5 to 2.0.6
Bumps [assert_cmd](https://github.com/assert-rs/assert_cmd) from 2.0.5 to 2.0.6.
- [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.5...v2.0.6)

---
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-11-08 08:22:00 -08:00
dependabot[bot]
375705c4d0 cargo: bump pest from 2.4.0 to 2.4.1
Bumps [pest](https://github.com/pest-parser/pest) from 2.4.0 to 2.4.1.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.4.0...v2.4.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-08 08:13:22 -08:00
dependabot[bot]
78418389b2 cargo: bump num_cpus from 1.13.1 to 1.14.0
Bumps [num_cpus](https://github.com/seanmonstar/num_cpus) from 1.13.1 to 1.14.0.
- [Release notes](https://github.com/seanmonstar/num_cpus/releases)
- [Changelog](https://github.com/seanmonstar/num_cpus/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/num_cpus/compare/v1.13.1...v1.14.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-08 08:11:38 -08:00
dependabot[bot]
9a4c4542bd cargo: bump predicates from 2.1.1 to 2.1.2
Bumps [predicates](https://github.com/assert-rs/predicates-rs) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/assert-rs/predicates-rs/releases)
- [Changelog](https://github.com/assert-rs/predicates-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/assert-rs/predicates-rs/compare/v2.1.1...v2.1.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-08 08:06:35 -08:00
dependabot[bot]
3958363777 cargo: bump clap from 4.0.18 to 4.0.22
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.18 to 4.0.22.
- [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.18...v4.0.22)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-08 07:59:44 -08:00
dependabot[bot]
5b5ab1fb3e cargo: bump regex from 1.6.0 to 1.7.0
Bumps [regex](https://github.com/rust-lang/regex) from 1.6.0 to 1.7.0.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.6.0...1.7.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-08 07:44:24 -08:00
dependabot[bot]
e326015c2a cargo: bump clap_complete from 4.0.3 to 4.0.5
Bumps [clap_complete](https://github.com/clap-rs/clap) from 4.0.3 to 4.0.5.
- [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.3...clap_complete-v4.0.5)

---
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-11-08 07:41:05 -08:00
dependabot[bot]
571952dac6 github: bump github/codeql-action from 2.1.30 to 2.1.31
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.30 to 2.1.31.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](18fe527fa8...c3b6fce4ee)

---
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-11-08 07:40:08 -08:00
Martin von Zweigbergk
3c7c4e9f5c tests: move testutils module into separate crate
The `testutils` module should ideally not be part of the library
dependencies. Since they're used by the integration tests (and the CLI
tests), we need to move them to a separate crate to achieve that.
2022-11-08 07:29:35 -08:00
Martin von Zweigbergk
924926a100 changelog: fix typo ("specity") 2022-11-07 13:48:48 -08:00
Yuya Nishihara
fa3ad16bf2 revset: add present(set) predicate that suppresses NoSuchRevision error
This is copied from Mercurial. Typical use case I have in mind is
"present(master) | present(main)" in stock revset.
2022-11-07 21:41:54 +09:00
Yuya Nishihara
ed14292aa2 revset: add EagerRevset::empty() constructor for convenience 2022-11-07 21:41:54 +09:00
Benjamin Saunders
46fe0791e8 cli: fix rebase error 2022-11-06 18:50:58 -08:00
Benjamin Saunders
210b54afd7 cli: hide cursor during progress display 2022-11-06 18:15:22 -08:00
Benjamin Saunders
472b6926e5 cli: define drop+signal guard helper 2022-11-06 18:15:22 -08:00
Benjamin Saunders
135e4d64dd cli: clean up progress error handling 2022-11-06 17:31:29 -08:00
Benjamin Saunders
d69eb808df git: prompt for credentials when needed 2022-11-06 17:31:29 -08:00
Benjamin Saunders
fd0a065801 cli: remove lifetime from Progress 2022-11-06 17:31:29 -08:00
Benjamin Saunders
a23cc8eb5a cli: factor out RemoteCallbacks setup 2022-11-06 17:31:29 -08:00
Benjamin Saunders
88a4f83cf8 git: factor ssh key lookup out of lib 2022-11-06 17:31:29 -08:00
Benjamin Saunders
b55c4ae0a3 git: move progress callback into a struct 2022-11-06 17:31:29 -08:00
Martin von Zweigbergk
a27da7d8d5 repo: remove last mutating method from ReadonlyRepo
`ReadonlyRepo::reindex()` is only used in `jj debug reindex`, and it
can be implemented by creating a new instance instead of mutating
`ReadonlyRepo`.
2022-11-06 16:43:54 -08:00
Ilya Grigoriev
cf3b6ee2c9 Include file list when editing split commit description
Example:

        JJ: Enter commit description for the first part (parent).
        Better split commit message

        JJ: This part contains the following changes:
        JJ:   M src/formatter.rs
        JJ:
        JJ: Lines starting with "JJ: " (like this one) will be removed.
2022-11-06 13:51:28 -08:00
Martin von Zweigbergk
a86de96bd4 cli: replace "current checkout" by "working-copy commit" 2022-11-05 22:56:14 -07:00
Martin von Zweigbergk
1d97f39da1 cleanup: avoid an unnecessary Box for argument to formatter
I think this cleanup was enabled by a recent refactoring that replaced
a trait object by a type parameter (3392e83486).
2022-11-05 22:49:54 -07:00