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

1215 commits

Author SHA1 Message Date
Martin von Zweigbergk
d6909002f0 repo: elide lifetime on resolve_change_id_prefix() 2023-02-13 22:49:21 -08:00
Martin von Zweigbergk
04a0c60b16 revset: remove code for conflict between commit/change id
Commit ids and change ids now use non-overlapping symbols for their
digits, so they can't share a prefix.
2023-02-13 22:49:21 -08:00
Martin von Zweigbergk
9261bfe5fc revset: resolve change ids only using the new hex digits
Now that we use the new hex digits when we display change ids, we no
longer need to be able to resolve the old (conventional) digits.
2023-02-13 22:49:21 -08:00
Martin von Zweigbergk
39640cc288 revset: allow resolving change id using hex digits from reverse alphabet
By separating the value spaces change ids and commit ids, we can
simplify lookup of a prefix. For example, if we know that a prefix is
for a change id, we don't have to try to find matching commit ids. I
think it might also help new users more quickly understand that change
ids are not commit ids.

This commit is a step towards that separation. It allows resolving
change ids by using hex digits from the back of the alphabet instead
of 0-f, so 'z'='0', 'y'='1', etc, and 'k'='f'. Thanks to @ilyagr for
the idea. The regular hex digits are still allowed.
2023-02-13 22:49:21 -08:00
dependabot[bot]
bc7a086192 cargo: bump test-case from 2.2.2 to 3.0.0
Bumps [test-case](https://github.com/frondeus/test-case) from 2.2.2 to 3.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/v2.2.2...v3.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>
2023-02-13 23:11:04 +00:00
Martin von Zweigbergk
4fbf09ed8c revset: remove obsolete silencing of Clippy check 2023-02-12 23:07:09 -08:00
Martin von Zweigbergk
a67fbb6714 cli: switch default graph style to be Sapling's curved style
We seem to quite unanimously prefer this style, so let's make the
default.
2023-02-12 07:23:29 -08:00
Samuel Tardieu
c0c3f87574 git fetch: prune old branch names before adding new ones 2023-02-12 02:10:17 +01:00
Vamsi Avula
daf7b656e3 config: add and parse ui.log_author_format for use in the default template
Supported values are,

- `none` for no author information,
- `full` for both the name and email,
- `name` for just the name,
- `username` for username part of the email,
- (default) `email` (or any other gibberish for that matter) for the full email.
2023-02-11 20:54:23 +05:30
Martin von Zweigbergk
3744ae4508 index: remove unused iter() function 2023-02-10 10:31:42 -08:00
dependabot[bot]
8eda80fc53 cargo: bump serde_json from 1.0.92 to 1.0.93
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.92 to 1.0.93.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.92...v1.0.93)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-09 16:33:11 +01:00
dependabot[bot]
67c7c27043 cargo: bump pest_derive from 2.5.4 to 2.5.5
Bumps [pest_derive](https://github.com/pest-parser/pest) from 2.5.4 to 2.5.5.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.5.4...v2.5.5)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-09 16:32:54 +01:00
Yuya Nishihara
038497638f revset: parse keyword arguments, accept remote_branches(remote=needle)
The syntax is identical to Mercurial's revset, which is derived from Python.
2023-02-09 12:11:58 +09:00
Yuya Nishihara
b2825c22d7 revset: move whitespace rule out of expression
There's a subtle difference between
 - 'expression = { whitespace* ... whitespace* }', and
 - '_{ whitespace* ~ expression ~ whitespace* }'.

The former includes surrounding whitespace in an "expression", the latter
doesn't. This affects the span of error indication.
2023-02-09 12:11:58 +09:00
Yuya Nishihara
78227dc7bc revset: consolidate argument parsing functions
The added expect_arguments() is basically a copy from the template_parser.
I'll reimplement it to support keyword arguments, so I don't care much about
the current implementation.

I leave expect_no/one_argument() as wrappers because parsing 0/1 arguments
is pretty common.

Error messages are slightly changed. I personally prefer not to add extra
code for singular/plural handling, but if we do, I'll add 'if N == 1' case.
2023-02-09 12:11:58 +09:00
dependabot[bot]
9791152cb9 cargo: bump pest from 2.5.4 to 2.5.5
Bumps [pest](https://github.com/pest-parser/pest) from 2.5.4 to 2.5.5.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.5.4...v2.5.5)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-08 08:24:00 -08:00
Martin von Zweigbergk
d1dc22d957 backend: let backend decide length of change id
As mentioned in the previous commit, our internal backend at Google
uses a 32-byte long change id. This commit will make us able to use
that.
2023-02-07 22:31:34 -08:00
Martin von Zweigbergk
e6693d0f68 backend: let backend choose root change id
Our internal backend at Google uses a 32-byte change id, so I'd like
to make the backend able to decide the length. To start with, let's
make the backend able to decide what the root change id should
be. That's consistent with how we already let the backend decide what
the root commit id should be.
2023-02-07 22:31:34 -08:00
Martin von Zweigbergk
98259346df backend: make hash_length() specifically about commit IDs
The function is currently only about the length of commit IDs, so
let's clarify that. I'm going to add another function for the length
of change IDs next. I don't know if we're going to care about lengths
of other hashes in the future. We might even be able to remove the
current restriction that all commit IDs and all change IDs have the
same length.
2023-02-07 22:31:34 -08:00
Yuya Nishihara
fa045d632c revset: allow trailing comma
It's unlikely we would write multi-line function call in revset, but let's
allow trailing comma for consistency.
2023-02-07 23:19:36 +09:00
dependabot[bot]
9826f5ce9c cargo: bump serde_json from 1.0.91 to 1.0.92
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.91 to 1.0.92.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.91...v1.0.92)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-06 15:26:01 +00:00
Martin von Zweigbergk
f4374086b3 git_backend: return error when told to write commit without parents
There should be no other commits than the root commit without parents.
2023-02-05 22:52:23 -08:00
Martin von Zweigbergk
8c63fbc4ed git_backend: don't panic if told to write merge with root commit
I think the CLI currently checks that the backend is not told to write
a merge commit with the root as one parent, but we should not panic if
those checks fail.
2023-02-05 22:52:23 -08:00
Martin von Zweigbergk
2b2a9a36d7 git_backend: test conversion of parents, including root
We didn't seem to have any tests showing how we convert the set of
parents, and especially how we handle the root commit, so let's add
some.
2023-02-05 22:52:23 -08:00
Ilya Grigoriev
5fb17925eb jj log: option to specify preferred id length
The new option is `ui.log-id-preferred-length`. Setting it to 6
is quite convenient for the `jj` repo, for example.

Screenshot: https://user-images.githubusercontent.com/4123047/216535699-ad1e2ac8-73dd-44be-b28a-ebdebc00c63c.png
2023-02-05 21:18:42 -08:00
dependabot[bot]
a42ce8773c cargo: bump bytes from 1.3.0 to 1.4.0
Bumps [bytes](https://github.com/tokio-rs/bytes) from 1.3.0 to 1.4.0.
- [Release notes](https://github.com/tokio-rs/bytes/releases)
- [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/bytes/compare/v1.3.0...v1.4.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-01 15:20:46 +00:00
dependabot[bot]
c6dc4ec811 cargo: bump zstd from 0.12.2+zstd.1.5.2 to 0.12.3+zstd.1.5.2
Bumps [zstd](https://github.com/gyscos/zstd-rs) from 0.12.2+zstd.1.5.2 to 0.12.3+zstd.1.5.2.
- [Release notes](https://github.com/gyscos/zstd-rs/releases)
- [Commits](https://github.com/gyscos/zstd-rs/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-31 22:32:47 +01:00
Ilya Grigoriev
6e05c5a829 jj log: Change the default of ui.unique-prefixes to "styled" 2023-01-30 22:48:38 -08:00
Martin von Zweigbergk
fafa9b70fc view: also merge git_heads when merging views
I don't know if I had just forgotten to merge `git_heads` when I added
it to the view object, but it seems like it should be merged just like
refs.
2023-01-30 09:05:03 -08:00
Martin von Zweigbergk
4e8fbaa210 git: allow conflicts in "HEAD@git"
Git's HEAD ref is similar to other refs and can logically have
conflicts just like the other refs in `git_refs`. As with the other
refs, it can happen if you run concurrent commands importing two
different updates from Git. So let's treat `git_head` the same as
`git_refs` by making it an `Option<RefTarget>`.
2023-01-30 09:05:03 -08:00
Glen Choo
3418c8ff73 git: add git.auto-local-branch
Add a new git.auto-local-branch config option. When set to false, a
remote-tracking branch imported from Git will not automatically create a
local branch target. This is implemented by a new GitSettings struct
that passes Git-related settings from UserSettings.

This behavior is particularly useful in a co-located jj and Git repo,
because a Git remote might have branches that are not of everyday
interest to the user, so it does not make sense to export them as local
branches in Git. E.g. https://github.com/gitster/git, the maintainer's
fork of Git, has 379 branches, most of which are topic branches kept
around for historical reasons, and Git developers wouldn't be expected
to have local branches for each remote-tracking branch.
2023-01-29 20:17:49 -08:00
Glen Choo
4716c1e9e2 git: test import of remote-only branch
This test coverage will become more important when we make changes to
remote branch importing.
2023-01-29 20:17:49 -08:00
Martin von Zweigbergk
5fecb396aa working_copy: write tree_state file on init
I don't think there's a good reason not to write the
`.jj/working_copy/tree_state` file on init. Being able to assume that
the file exists means that we won't need the store object to to lazily
load the `TreeState` object. Well, except that `TreeState` keeps an
`Arc<Store>`, but I'm trying to change that.
2023-01-29 20:01:22 -08:00
Martin von Zweigbergk
2971c45e04 index_store: don't look up whole commit when only id is needed
When building an initial index from an existing Git repo, for example,
we walk parents and predecessors to find all commits to index. Part of
that code was looking up the whole parent and predecessor commits even
though it only needed the ids. I don't know if this has a measurable
impact on performance, but it's not really any more complex to just
get the ids anyway.
2023-01-29 10:45:03 -08:00
Martin von Zweigbergk
be638d0205 dag_walk: delete unused common_ancestor() 2023-01-29 10:42:11 -08:00
Martin von Zweigbergk
aaf75b4793 repo: inline single-caller, and surprising, Commit::is_empty()
I would expect `Commit::is_empty()` to check if the commit is empty in
our usual sense, i.e. that there are no changes compared to the
auto-merged parents. However, it would return `false` for any merge
commit (and for the root commit). Since we only use it in one place,
let's inline it there. The use there does seem reasonable, because
it's about abandoning an "uninteresting" working-copy commit.
2023-01-28 15:54:03 -08:00
Samuel Tardieu
a7aed0171d style: fix typos found by codespell 2023-01-28 07:23:45 -08:00
Martin von Zweigbergk
d8942d5f96 cli: rename ui.graph.format to ui.graph.style
I think of it more as style than a format, so using `style` in the
config key makes sense to me.

I didn't bother making upgrades easy by supporting the old name since
this was just released and only a few developers probably have it set.
2023-01-27 10:36:26 -08:00
Martin von Zweigbergk
0b99e5b16e graphlog: enable Sapling's graph styles by default
I would also rename the feature, but I hope we can instead soon make
it a non-optional dependency and delete the feature.
2023-01-27 09:46:57 -08:00
Yuya Nishihara
d771c12637 index: make HexPrefix accessor simply return "min" prefix as bytes slice
This is low-level function, so I think using &[u8] should be good here.
2023-01-27 03:37:44 +09:00
Yuya Nishihara
770ca72a1f index: use iterator to simplify segment_resolve_prefix() a bit further 2023-01-27 03:37:44 +09:00
Yuya Nishihara
956a2d5f83 index: remove redundant prefix tests from resolve_prefix functions
The "min" prefix guarantees that the first entry matches the hex prefix
if any. Spotted by @ilyagr.
2023-01-27 03:37:44 +09:00
Yuya Nishihara
b4c837fd4a index: simplify segment_resolve_prefix() loop to make both impls look close 2023-01-27 03:37:44 +09:00
Yuya Nishihara
b9fc6d4203 templater: rewrite divergent property by leveraging IdIndex 2023-01-26 14:10:26 +09:00
Yuya Nishihara
824f2106fd repo: migrate revset::resolve_change_id() to use IdIndex for ReadonlyRepo
The MutableRepo implementation is the same as before.
2023-01-26 14:10:26 +09:00
Yuya Nishihara
4f15d1f779 repo: implement method to look up change_id prefix by using IdIndex
revset::resolve_change_id() for ReadonlyRepo will be replaced with this
implementation. This doesn't mean revset query will speed up. A trivial
query will become slower due to the initialization cost of the change id
index. "jj log -r hex" will get faster since we have to pay the cost anyway.

Benchmark numbers (against my "linux" repo):

Command:
    hyperfine --warmup 3 --runs 20 \
      "jj log -r $hex -T '' --no-commit-working-copy --no-graph"

Linear search (e874570947):
    Time (mean ± σ):     223.9 ms ±  16.2 ms    [User: 181.2 ms, System: 42.7 ms]
    Range (min … max):   207.7 ms … 247.6 ms    50 runs

Building IdIndex:
    Time (mean ± σ):     855.0 ms ±  21.7 ms    [User: 788.4 ms, System: 66.6 ms]
    Range (min … max):   822.6 ms … 927.5 ms    50 runs

Building IdIndex, but hacked to store SmallVec<[u8; 20]>:
    Time (mean ± σ):     406.1 ms ±  15.9 ms    [User: 354.1 ms, System: 52.0 ms]
    Range (min … max):   382.2 ms … 428.6 ms    50 runs

For my "jj" work repo, changes are < ~1ms.
2023-01-26 14:10:26 +09:00
Yuya Nishihara
38a9180bb7 repo: generalize IdIndex over key and value types
Though we'll only need IdIndex<ChangeId, IndexPosition>, this allows us to
write unit tests without setting up MutableIndex.
2023-01-26 14:10:26 +09:00
Martin von Zweigbergk
10725c095f cleanup: update more "checkout" to "working-copy commit" and similar
I've preferred "working-copy commit" over "checkout" for a while
because I think it's clearer, but there were lots of places still
using "checkout". I've left "checkout" in places where it refers to
the action of updating the working copy or the working-copy commit.
2023-01-25 11:02:59 -08:00
Martin von Zweigbergk
37ba17589d simple_op_heads_store: rename storage directory
`SimpleOpHeadsStore` currently stores its files in
`.jj/repo/op_heads/simple_op_heads/`. The `.jj/repo/op_heads/type`
file indicates the type of op-heads backend. If that contains
"simple_op_head_store", we use the `SimpleOpHeadsStore`
backend. There's no need for the `simple_op_heads` directory to also
indicate the type of backend in its name. I kept just the `heads` in
the name to make it less redundant with the parent directory (which is
`op_heads)`. We could alternatively call the directory `values` or
similar.
2023-01-25 09:22:38 -08:00
Martin von Zweigbergk
0d1ec835c1 repo: rename .jj/repo/store/backend to .jj/repo/store/type
We decided to call the files identifying the backend type `type`. We
already use that name for `OpStore` and `OpHeadsStore`.
2023-01-25 09:22:38 -08:00