Commit Graph

1225 Commits

Author SHA1 Message Date
Martin von Zweigbergk
2ac62203d5 tests: add test for invalid config (#55) 2022-03-27 21:11:55 -07:00
Martin von Zweigbergk
d68eee296e tests: check that stderr is empty after successful commands
Successful commands should probably not write to stderr. If we later
add commands that e.g. print warnings to stderr, we'll want to cover
that explicitly in test.
2022-03-27 21:11:55 -07:00
Martin von Zweigbergk
12bce70bed cli: display how many commits were rebased when merging operations (#111)
This involved copying `UnresolvedHeadRepo::resolve()` into the CLI
crate (and modifying it a bit to print number of rebased commit),
which is unfortunate.
2022-03-26 22:31:49 -07:00
Martin von Zweigbergk
f7abeed2a6 transaction: move rebasing of descendants out of merge_operation() (#111)
I want to do the rebasing a bit later, so the CLI can do it and print
how many commits got rebased.
2022-03-26 22:31:49 -07:00
Martin von Zweigbergk
a0f05a60e4 repo: inline merge_op_heads() (#111)
The function is now pretty simple, and there's only one caller, so
let's inline it. It probably makes sense to move the code out of
`repo.rs` at some point.
2022-03-26 22:31:49 -07:00
Martin von Zweigbergk
d45a25b1ee op_heads_store: return operations sorted by timestamp (#111)
It's cheap to sort them, so let's have them always sorted, so all
callers can rely on that order.
2022-03-26 22:31:49 -07:00
Martin von Zweigbergk
d62cc15ff0 repo: move merge with operation to transaction (#111)
It's the transaction's job to create a new operation, and that's where
the knowledge of parent operations is. By moving the logic for merging
in another operation there, we can make it contiuously update its set
of parent operations. That removes the risk of forgetting to add the
merged-in operation as a parent. It also makes it easier to reuse the
function from the CLI so we can inform the user about the process
(which is what I was investigating when I noticed that this cleanup
was possible).
2022-03-26 22:31:49 -07:00
Martin von Zweigbergk
4d64687bc3 transaction: keep whole operation objects, not just IDs, of parents (#111)
We already have the operation objects, and keeping them will allow
some cleanup (see next change).
2022-03-26 22:31:49 -07:00
Martin von Zweigbergk
04ad9a3628 repo: when merging in removed head, rebase descendants (#111) 2022-03-26 22:31:49 -07:00
Martin von Zweigbergk
ec84de7779 repo: clarify that some repo functions load the repo at head (#111) 2022-03-26 22:31:49 -07:00
Martin von Zweigbergk
749ea62c08 cli: let the user know if there's been a concurrent modification (#111) 2022-03-26 22:31:49 -07:00
Martin von Zweigbergk
a38dd9d693 repo: make resolution of concurrent operations a separate step (#111)
This is yet another refactoring step to allow the UI layer to inspect
and control how concurrent operations are resolved.
2022-03-26 22:31:49 -07:00
Martin von Zweigbergk
e384f97b20 transaction: check that we haven't forgotten to rebase descendants (#111)
If we have recorded in `MutableRepo` that commits have been abandoned
or rewritten, we should always rebase descendants before committing
the transaction (otherwise there's no reason to record the
rewrites). That's not much of a risk in the CLI because we already
have that logic in a central place there (`finish_transaction()`), but
other users of the library crate could easily miss it. Perhaps we
should automatically do any necessary rebasing we commit the
transaction in the library crate instead, but for now let's just have
a check for that to catch such bugs.
2022-03-26 22:31:49 -07:00
Martin von Zweigbergk
eb333dc07d cli: move optimization for no-op rebases into MutableRepo (#111)
Certain commands should never rewrite commits, or they take care of
rebasing descendants themselves. We have an optimization in
`commands.rs` for those commands, so they skip the usual automatic
rebasing before committing the transaction. That's risky to have to
remember and `MutableRepo` already knows if any commits have been
rewritten (that wasn't the case before, in the Evolution-based
code). So let's just have `MutableRepo` do the check instead.
2022-03-26 22:31:49 -07:00
Martin von Zweigbergk
11525bfba0 repo: move resolving of concurrent operations to repo level (#111)
It's useful for the UI layer to know that there's been concurrent
operations, so it can inform the user that that happened. It'll be
even more useful when we soon start making the resolution involve
rebasing commits, since that's even more important for the UI layer to
present to the user. This patch gets us a bit closer to that by moving
the resolution to the repo level.
2022-03-26 22:31:49 -07:00
Martin von Zweigbergk
364f8010e7 op_heads_store: remove Result that never fails (#111) 2022-03-26 22:31:49 -07:00
Martin von Zweigbergk
40aa9741ec op_heads_store: move lock and updating of heads on disk to new type (#111)
We had a few lines of similar code where we added a new of the
operation log and then removed the old heads. By moving that code into
a new type, we prepare for further refactorings.
2022-03-26 22:31:49 -07:00
Martin von Zweigbergk
39838a76bf view: move merging of views up to repo level (#111)
I want to make it so when we apply a repo-level change that removes a
head, we rebase descendants of that head onto the closes visible
ancestor, or onto its successor if the head has been rewritten (see
#111 for details). The view itself doesn't have enough information for
that; we need repo-level information (to figure out relationships
between commits).

The view doesn't have enough information to do the.
2022-03-26 22:31:49 -07:00
Martin von Zweigbergk
a663a5d89c repo: don't abandon empty commit if it has descendants
It's unusual for the current commit to have descendants, but it can
happen. In particular, it can easily happen when you run `jj new`. You
probably don't want to abandon it in those cases.
2022-03-26 21:11:42 -07:00
Martin von Zweigbergk
0ceb4f0dce cli: teach jj new to set initial description with -m
I rarely use `jj new`, so this feature is mostly for use in tests.
2022-03-26 21:11:42 -07:00
Martin von Zweigbergk
23c7581ce1 tests: add a convenience function for running jj successfully
We very often expect success, and we sometimes want to get the stdout,
too. Let's add a convenience function for that. It saves a lot of
lines of code.
2022-03-26 21:11:42 -07:00
Martin von Zweigbergk
03aad3ac2e cli: don't explicitly indicate positional argument's index
I had accidentally given the two positional arguments for `jj git
remote add` the same index. While fixing that, I realized that maybe
`clap` can infer the index based on the declaration order in the
struct. That does indeed seem to work, so I just removed all the
explicit `index` arguments instead.
2022-03-23 22:22:53 -07:00
Martin von Zweigbergk
9e6e5f3d54 cli: make functions delegating to subcommand a single expression 2022-03-23 15:17:21 -07:00
Martin von Zweigbergk
66fe23b4e9 cli: switch from clap's Builder API to its Derive API
The Derive API is easier to work with, less error-prone, and less
verbose, so it seems like a good improvement.

It was quite a bit of work to make the switch, and I'll be surprised
if I didn't make any mistakes in the translation. We unfortunately
don't have enough e2e tests to be very confident, so we'll have to fix
any problems as we discover them.

I've at least verified that the output of `jj debug completion --fish`
is unchanged, except for a few help texts I changed for different
reasons (consistency, clarity, avoiding redundancy).
2022-03-23 15:17:21 -07:00
Martin von Zweigbergk
11afbc70f9 cli: delete unimplemented jj debug writeworkingcopy command
I deleted the implementtion a long time ago, but I forgot to remove it
from the `clap::Command`.
2022-03-23 15:17:21 -07:00
Martin von Zweigbergk
bf62e1789f cargo: update lock file
With the current dependencies in the lock file, we cannot use `clap`'s
"derive" feature, which I'd like to do.
2022-03-23 15:17:21 -07:00
Martin von Zweigbergk
2f59e8b68a cli: respect $NO_COLOR environment variable 2022-03-23 09:57:42 -07:00
Martin von Zweigbergk
7ba1c6bdb6 config: add support for a $JJ_CONFIG environment variable
It's useful for tests, scripts, and debugging to be able to use
specific config instead of the user's config. That's especially true
for our automated tests because they didn't have a place to read
config from on Windows before this patch (they read their config from
`{FOLDERID_RoamingAppData}`, which I don't think we can override in
tests).
2022-03-23 09:57:42 -07:00
Martin von Zweigbergk
3b507e4a2e config: use platform-specific directory separator in jj/config.toml
I don't know if Windows actually cares, but it seems more correct this
way.
2022-03-23 09:57:42 -07:00
Martin von Zweigbergk
095fb9fef4 config: drop support for ~/.jjconfig
I'm a little hesitant to do this because most tools I'm familiar with
have the config file directly in `~/`. It's also easier to describe
where to put the file if it doesn't vary across platforms. But we're
still early in the project, so let's try it and see if we get any
complaints.
2022-03-23 09:57:42 -07:00
Martin von Zweigbergk
1d3f909a3b config: move reading of config from lib crate to CLI crate
The library crate should be usable by e.g. server processes, so it
should not read from the current user's home directory.
2022-03-23 09:57:42 -07:00
Martin von Zweigbergk
eff615998f github: add reminder in PR template about updating the changelog 2022-03-23 09:57:42 -07:00
dependabot[bot]
302b4025d5 cargo: bump test-case from 2.0.0 to 2.0.1
Bumps [test-case](https://github.com/frondeus/test-case) from 2.0.0 to 2.0.1.
- [Release notes](https://github.com/frondeus/test-case/releases)
- [Changelog](https://github.com/frondeus/test-case/blob/master/CHANGELOG.md)
- [Commits](https://github.com/frondeus/test-case/compare/v2.0.0...v2.0.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-22 09:33:22 -07:00
Martin von Zweigbergk
b4e6fab1af github: restrict Clippy's access again
It seems "checks" is the permissions it needs to be able to comment on
pull-requests.
2022-03-18 22:51:25 -07:00
Martin von Zweigbergk
3f24411bbf cargo: upgrade the config crate from 0.11.0 to 0.12.0
This required a bit of work.
2022-03-18 22:33:04 -07:00
dependabot[bot]
36a575ccbf github: bump actions-rs/cargo from 1.0.1 to 1.0.3
Bumps [actions-rs/cargo](https://github.com/actions-rs/cargo) from 1.0.1 to 1.0.3.
- [Release notes](https://github.com/actions-rs/cargo/releases)
- [Changelog](https://github.com/actions-rs/cargo/blob/master/CHANGELOG.md)
- [Commits](ae10961054...844f36862e)

---
updated-dependencies:
- dependency-name: actions-rs/cargo
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-18 08:53:12 -07:00
dependabot[bot]
bde79f7a60 github: bump actions-rs/toolchain from 1.0.6 to 1.0.7
Bumps [actions-rs/toolchain](https://github.com/actions-rs/toolchain) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/actions-rs/toolchain/releases)
- [Changelog](https://github.com/actions-rs/toolchain/blob/master/CHANGELOG.md)
- [Commits](b2417cde72...16499b5e05)

---
updated-dependencies:
- dependency-name: actions-rs/toolchain
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-18 08:45:06 -07:00
Martin von Zweigbergk
53721f7d25 github: pin cachix/install-nix-action version by hash 2022-03-17 09:19:12 -07:00
Martin von Zweigbergk
23c92ccf45 github: pin actions-rs/clippy-check version by hash 2022-03-17 09:19:12 -07:00
Martin von Zweigbergk
de56053531 github: pin actions-rs/toolchain version by hash 2022-03-17 09:19:12 -07:00
Martin von Zweigbergk
d6967fd690 github: pin actions/upload-release-asset version by hash 2022-03-17 09:19:12 -07:00
Martin von Zweigbergk
13f7354cfe github: pin actions-rs/cargo version by hash 2022-03-17 09:19:12 -07:00
Martin von Zweigbergk
b36e50c09d github: pin actions/checkout version by hash 2022-03-17 09:19:12 -07:00
Martin von Zweigbergk
cc13a2ec84 release: include the two recent no-op releases in the changelog
I keep forgetting to update things while doing a release...
2022-03-17 06:03:10 -07:00
dependabot[bot]
4fab28ffc6 github: bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-16 22:57:55 -07:00
Martin von Zweigbergk
2a76572653 docs: add pointer to pre-built binary releases (#73)
Users now have the option of installing from source or directly
installing a binary.

I also corrected some text that effectively said that installing a Nix
flake is not installing from source, but I think it actually does
install from source.
2022-03-16 22:57:38 -07:00
dependabot[bot]
30e3685f5e cargo: bump regex from 1.5.4 to 1.5.5
Bumps [regex](https://github.com/rust-lang/regex) from 1.5.4 to 1.5.5.
- [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.5.4...1.5.5)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-16 22:57:09 -07:00
dependabot[bot]
f14b1260e5 cargo: bump rand from 0.8.4 to 0.8.5
Bumps [rand](https://github.com/rust-random/rand) from 0.8.4 to 0.8.5.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/compare/0.8.4...0.8.5)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-16 22:27:45 -07:00
dependabot[bot]
85d4ac7d47 cargo: bump clap from 3.1.2 to 3.1.6
Bumps [clap](https://github.com/clap-rs/clap) from 3.1.2 to 3.1.6.
- [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/v3.1.2...v3.1.6)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-16 22:12:52 -07:00
dependabot[bot]
a8f881b84c cargo: bump test-case from 1.2.3 to 2.0.0
Bumps [test-case](https://github.com/frondeus/test-case) from 1.2.3 to 2.0.0.
- [Release notes](https://github.com/frondeus/test-case/releases)
- [Changelog](https://github.com/frondeus/test-case/blob/master/CHANGELOG.md)
- [Commits](https://github.com/frondeus/test-case/compare/v1.2.3...v2.0.0)

---
updated-dependencies:
- dependency-name: test-case
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-16 22:07:44 -07:00