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

2004 commits

Author SHA1 Message Date
dependabot[bot]
da284f5410 cargo: bump assert_cmd from 2.0.6 to 2.0.7
Bumps [assert_cmd](https://github.com/assert-rs/assert_cmd) from 2.0.6 to 2.0.7.
- [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.6...v2.0.7)

---
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-12-05 10:07:10 -08:00
dependabot[bot]
6192183d2b cargo: bump predicates from 2.1.3 to 2.1.4
Bumps [predicates](https://github.com/assert-rs/predicates-rs) from 2.1.3 to 2.1.4.
- [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.3...v2.1.4)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-05 10:00:11 -08:00
dependabot[bot]
92f3dca4bd cargo: bump pest from 2.5.0 to 2.5.1
Bumps [pest](https://github.com/pest-parser/pest) from 2.5.0 to 2.5.1.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.5.0...v2.5.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-12-05 09:48:28 -08:00
dependabot[bot]
2deb2f5e71 cargo: bump config from 0.13.2 to 0.13.3
Bumps [config](https://github.com/mehcode/config-rs) from 0.13.2 to 0.13.3.
- [Release notes](https://github.com/mehcode/config-rs/releases)
- [Changelog](https://github.com/mehcode/config-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mehcode/config-rs/compare/0.13.2...0.13.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-05 09:35:44 -08:00
dependabot[bot]
726c042b12 cargo: bump libc from 0.2.137 to 0.2.138
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.137 to 0.2.138.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.137...0.2.138)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-05 09:35:14 -08:00
dependabot[bot]
113c160baf cargo: bump serde from 1.0.148 to 1.0.149
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.148 to 1.0.149.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.148...v1.0.149)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-05 09:34:42 -08:00
Martin von Zweigbergk
a0573b1737 cli: add a command for updating a stale working copy
When a workspace's working-copy commit is updated from another
workspace, the workspace becomes "stale". That means that the working
copy on disk doesn't represent the commit that the repo's view says it
should. In this state, we currently automatically it to the desired
commit next time the user runs any command in the workspace. That can
be undesirable e.g. if the user had a slow build or test run started
in the working copy. It can also be surprising that a checkout happens
when the user ran a seemingly readonly command like `jj status`.

This patch makes most commands instead error out if the working copy
is stale, and adds a `jj workspace update-stale` to update it. The
user can still run commands with `--no-commit-working-copy` in this
state (doing e.g. `jj --no-commit-working-copy rebase -r @ -d @--` is
another way of getting into the stale-working-copy state, by the way).
2022-12-05 08:50:52 -08:00
Martin von Zweigbergk
e1be0f5096 cli: extract a function for loading the workspace
I want to be able to create a `WorkspaceCommandHelper` without
snapshotting the working copy. That will be useful when adding a
command for updating a stale working copy.
2022-12-05 08:50:52 -08:00
Martin von Zweigbergk
18b80f4008 cli: make checking for stale working copy independent of UI
This patch makes the function checking for a stale working copy return
a specialized error instead of `CommandError`. That has several advantages:

 * It makes it easier to change the behavior so we don't automatically
   update a stale working copy until the user explicitly tells us.

 * It allows us to move the function to the library crate, to be
   shared by non-CLI UIs (and server applications).
2022-12-05 08:50:52 -08:00
Martin von Zweigbergk
f7d0c196c1 cli: extract a function for checking for stale working copy
Similar to the previous commit, the checking for stale working copy is
a big part of `commit_working_copy()` and it's logically quite
separated from the rest, so let's extract it to a function.
2022-12-05 08:50:52 -08:00
Martin von Zweigbergk
2282047d3b cli_util: extract a function for creating a helper given a workspace
The code for creating a `WorkspaceCommandHelper` for a given
`Workspace` is a well-separated part of the large
`workspace_helper()`, so lets extract it to a function.
2022-12-05 08:50:52 -08:00
Ilya Grigoriev
e9952bcf76 Minimal version of resolve --list
Simply lists conflicted files
2022-12-04 22:58:12 -08:00
Ilya Grigoriev
ea1395ad95 Make optional the path argument to resolve, allow partial paths
Also allows several paths to be specified. By default, `jj resolve`
will find the first conflict that matches provided paths (if any)
and try to resolve it.
2022-12-04 22:39:45 -08:00
Ilya Grigoriev
acb0e9751d Add a Tree method to return conflicts matching a matcher
This is useful for `jj resolve`.
2022-12-04 22:39:45 -08:00
Ilya Grigoriev
b58be8d7a4 Mention path in message for ConflictResolveError::NotNormalFilesError. 2022-12-04 22:39:45 -08:00
Martin von Zweigbergk
48c44344bf cli: make jj status not just care about the first parent
It seems like I forgot to update the `jj status` output when I decided
(years ago?) that the changes in a commit should always be compared to
the auto-merged parents. I was very confused before I realized that
`jj status` was showing the diff summary against the first parent. I
suppose the fact that `jj status` lists only one parent should have
been a hint. Thanks to ilyagr@ for finding this odd behavior. This
patch fixes it by making the command list all parents, and changes the
diff summary to be against the auto-merged parents.
2022-12-04 22:29:12 -08:00
Yuya Nishihara
f4953cdb60 index: return early from RevWalk if items get filled with unwanted 2022-12-05 14:31:14 +09:00
Yuya Nishihara
2a00481ec5 index: make RevWalk push all parents and deduplicate later on pop()
The idea behind this is to extend RevWalk to track generation (or depth from
the initial wanted items.) Basic DAG walk doesn't need such data, but a query
like 'rev---' could be translated to a RevWalk yielding nth ancestors.
The default log revset can also be expressed as 0/1-th ancestors of
'(remote_branches() | tags())..'.

Also, this appears to be faster than using boundary sets, based on the
bench extracted from test_index_commits_criss_cross().
2022-12-05 14:31:14 +09:00
Martin von Zweigbergk
dc8830843e cli: use pager for print
The `print` command shows the contents of a file, so that is obviously
often more than a page long. Both `hg cat file` and `git show
HEAD:file` page the output.
2022-12-04 20:52:29 -08:00
Martin von Zweigbergk
8e994a28fe cli: use pager for files
The output from `files` is often longer than a screen, so the pager is
useful, even though this command is probably used mostly by
scripts. As with `status`, `hg` pages its output, but `git` doesn't.
2022-12-04 20:52:29 -08:00
Martin von Zweigbergk
cb9ba5abc1 cli: enable pager on status
The status output may be long, so the pager can useful. Now that we
pass `-F` to the pager by default, it should also be fine to use the
pager for short output. For reference, `hg` pages `status` output, but
`git` doesn't.
2022-12-04 20:52:29 -08:00
Luke Granger-Brown
e95b8edca1 Give the "unset user" warning a trailing newline.
At the moment, the unset user warning is lacking a trailing newline, so
we end up printing anything else that's output directly on the same line.
2022-12-04 18:01:09 -08:00
Ilya Grigoriev
c52a14eac6 Remove an unused import warning on recent versions of Rust
This warning used to show up, at least, on Rust nightly:
     unused import: `crate::nightly_shims::BTreeSetExt`
2022-12-04 13:15:42 -08:00
Yuya Nishihara
e17fc89a8d revset: make filter node unary, move candidates to outer intersection
In order to optimize a query like '(author(_) | @) & main..', we'll probably
need a predicate form of an iterable set so that the query can be evaluated
to '(main..).iter().filter(author(_) | @)'. And if a predicate function can
terminate the source iterator early (by returning true/false/false_forever),
complexity of a filtered revset is basically the same as an intersection of
iterator pair. This means we can eventually merge IntersectionRevset with
FilterRevset.

With that in mind, this patch removes the redundant 'candidates' field from
the filter node, which would otherwise appear in the predicate function as
'candidates.contains(entry)'. A filter node with candidates was somewhat
useful while rewriting the tree, but that can be dealt with a view function
like as_filter_intersection() in this patch.

This also simplify the subsequent filter transformation as we no longer need
to test if candidates == All.
2022-12-05 00:32:18 +09:00
Yuya Nishihara
6d977c73e4 revset: add test of filter intersection over non-linear tree
Previously we only have a test for the left recursion. The added test
contains right recursion path, which should have caught the error I made
while working on the next "unary filter node" patch.
2022-12-05 00:32:18 +09:00
Yuya Nishihara
48d426529c revset: update doc of filter transformation, apply minor style change
The doc comment summarizes what I'm going to implement. I'm not sure if
we'll add all of them because revset evaluation isn't the key performance
bottleneck at the moment. Anyway, I don't think any of these ideas would
logically conflict with segmented changelog adaptation unless we decide to
replace the whole revset stack with Eden/Sapling's.
2022-12-05 00:32:18 +09:00
Yuya Nishihara
ec6f2cf393 revset: extract function that builds predicate function from spec 2022-12-05 00:32:18 +09:00
Yuya Nishihara
ce84d17060 cli: spawn pager after command arguments are validated
Just like hg, it's probably better to show short error message without pager.
2022-12-04 23:08:01 +09:00
Martin von Zweigbergk
c5c89b9e9b pager: default to less -FRX
As dbarnett@ reported on #9, our default of `less`, combined with our
default of enabling color on TTYs, means that we print ANSI codes to
`less` by default. Unless the user has set e.g. `$LESS=R`, `less` is
going to escape those codes, resulting in garbage like this:

```
@ ESC[1;35mbb39c26a29feESC[0m ESC[1;33m(no email configured)ESC[0m ESC[1;36m2022-12-03....
```

I guess most of us didn't notice because we have something like
`$LESS=FRX` set.

This patch changes our default from `less` to `less -FRX`. Those are
the flags we're using for our internal hg distribution at Google, and
that has seemed quite uncontroversial.

I added a pointer from the changelog to the tracking issue while at
it.
2022-12-04 00:00:31 -08:00
Martin von Zweigbergk
be383cebc7 git: on import, add GC-preventing refs to all seen refs
To prevent git's GC from breaking a repo, we already add a git ref to
commits we create in the git backend. However, we don't add refs to
commits we import from git. This fixes that.

Closes #815.
2022-12-03 22:50:26 -08:00
Martin von Zweigbergk
9df247f87c git: on import, update record of ref only if it changed
There's no need to update our record of the ref if it didn't
change. This is just about making it clearer; I doubt it will have
measurable performance impact.
2022-12-03 22:50:26 -08:00
Martin von Zweigbergk
84a4dee673 thrift: add legacy-thrift Cargo feature
This patch adds a `legacy-thrift` Cargo feature that's enabled by
default. If it's disabled, the upgrade from Thrift-based operation log
does not happen, and the `thrift` depdendency is not included.
2022-12-03 22:31:02 -08:00
Martin von Zweigbergk
6b964218bf legacy_thrift_op_store: remove implementation write methods 2022-12-03 22:31:02 -08:00
Martin von Zweigbergk
c269b72fb3 op_store: auto-upgrade existing repos from Thrift to Protobuf
With this patch, we auto-upgrade existing repos that use Thrift format
for the operation log to use Protobuf format. That would only be repos
used with an unreleased version of jj after 0.5.1 (which may be the
majority of repos?).

The upgrade from Thrift is simpler because we now use the same hashing
scheme for the Protobuf-based storage, so the operation and view IDs
remain the same as they were in the Thrift-based storage. We could
simplify the code a bit more as a result, but since this code is
supposed to be short-lived, I didn't bother.

Since the change from the Protobuf format with the old hashing scheme
to a the (same) Protobuf format with the new hashing scheme shouldn't
impact users, I removed the entry we had in the changelog about the
format change.
2022-12-03 22:31:02 -08:00
Martin von Zweigbergk
5a9d1e5fdd op_store: rename variables in upgrade code to be direction-agnostic
The code for migrating from ProtoBuf to Thrift is almost completely
independent of which direction the upgrade goes, so we can very easily
reuse it for migrating from Thrift to Protobuf. This patch renames
some variables to "old/new" instead of "proto/thrift", making the next
patch even simpler.
2022-12-03 22:31:02 -08:00
Martin von Zweigbergk
472dee6403 op_store: move ThriftOpStore to new file
Since we're now allowed to use the `protobuf` crate, I'm going to make
`SimpleOpStore` use it again. This moves the `ThriftOpStore` into a
new `legacy_thrift_op_store.rs` file.
2022-12-03 22:31:02 -08:00
Martin von Zweigbergk
fdf43b845a content_hash: absorb duplicate hash() functions
We use the same blake2b hash for `ContentHash` impls in several
places, and I'm about to add more places, so let's centralize the
helper function.
2022-12-03 22:31:02 -08:00
Martin von Zweigbergk
c0a819e94a op_store: remove legacy_protobuf Cargo feature
Since we now have approval to use the `protobuf` crate at Google, it's
no longer the "legacy" format, so we should remove it. I'll almost
definitely soon add `legacy_thrift` feature instead.
2022-12-03 22:31:02 -08:00
Martin von Zweigbergk
7e224003e3 changelog: copy formatting of links to issues from Cargo
I thought I had seen our current formatting, i.e. `(#123)`, get
auto-linked by GitHub, but it seems it doesn't. This patch therefore
changes to use markdown links. I copied the style from Cargo (and
Clippy).
2022-12-03 22:31:02 -08:00
Martin von Zweigbergk
d3dffe933c changelog: remove mention of native backend's hashing scheme
The change in hashing scheme should not even be noticeable, except
maybe because the same objects may be saved twice and take extra
space, and may be slower because we compare the contents for equality
instead of short-circuiting when we the hash matches.
2022-12-03 22:31:02 -08:00
Ilya Grigoriev
8222ba94cf Documentation for jj resolve and merge tool config 2022-12-03 15:12:40 -08:00
Ilya Grigoriev
e3fd49993e Add a default merge tool config for meld, vimdiff, kdiff3. 2022-12-03 15:12:40 -08:00
Ilya Grigoriev
d6c1b0bc9c jj resolve: option to parse conflict markers + tests
If this new option is not specified, we start with empty output
file and trust the merge tool did a complete merge no matter
what the file contains.

Includes tests.
2022-12-03 15:12:40 -08:00
Ilya Grigoriev
3e86baa7f1 Test basic jj resolve functionality 2022-12-03 15:12:40 -08:00
Ilya Grigoriev
c2a4198efc Make fake-editor error output even more verbose
This is a followup to f4b175a8. When debugging `fake-editor`
failures, it is often useful to distinguish empty files,
files consisting of a single "\n" and so on.
2022-12-03 15:12:40 -08:00
Ilya Grigoriev
aeeae0af18 jj resolve: error when merge tool args are not configured 2022-12-03 15:12:40 -08:00
Ilya Grigoriev
1eccd3430f Make the choice and arguments of mergetool configurable
Also makes the merge/diff tool binary default to the tool's name
(thus changing the diff editor behavior slightly)
2022-12-03 15:12:40 -08:00
Ilya Grigoriev
1158600c80 New jj resolve command to resolve conflicts
This command uses an external merge tool to resolve conflicts
simple enough that they can be resolved with a 3-way merge.

This commit provides a very basic version of `jj resolve` that
is hardcoded to use vimdiff.

This also slightly changes the errors of the Diff Editor, so that
both the diff editor and `jj resolve can share an error type.
2022-12-03 15:12:40 -08:00
Ilya Grigoriev
55762e3681 Rename FileConflictData to ConflictHunk, use it in files.rs.
There's no point in having two identical types used for the same
purpose in two different places.
2022-12-03 15:12:40 -08:00
Ilya Grigoriev
85b472b507 Expose functions useful for conflict resolution UI
This refactors `conflicts.rs` to:

1. Make `describe_conflict` public

2. Extract the functionality to create text version of
a conflict as the `materialize_merge_result` function.

3. Extract the functionality to turn a conflicted file
into the complete contents of each version of the file
"added" or removed" (when possible). This becomes the
`extract_file_conflict_data` function.

This is useful in order to present these text versions
in a merge tool.
2022-12-03 15:12:40 -08:00