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

3199 commits

Author SHA1 Message Date
Martin von Zweigbergk
b6b3703800 cli: make jj move nonexistent succeed
I think `jj move nonexistent` should not be an error. That matches how
`jj squash` works. I added tests for both commands.
2023-04-30 07:29:19 -07:00
Martin von Zweigbergk
9230fd93bb cli: store ArgMatches in CommandHelper
This will make it easily available everywhere so we can get more
detailed information about arguments passed to commands. In
particular, I think it can be useful for displaying different hints
depending on whether the user passed `-r @` or if the `@` revision was
from the defaults.
2023-04-30 07:29:19 -07:00
Grégoire Geis
0628379eed fix windows warnings in src/cleanup_guard.rs
Fix warnings encountered on non-Unix platforms:

```
Compiling jujutsu v0.7.0 (C:\github.com\71\jj)
warning: unnecessary `unsafe` block
  --> src\cleanup_guard.rs:17:29
   |
17 |         if let Err(ref e) = unsafe { platform::init() } {
   |                             ^^^^^^ unnecessary `unsafe` block
   |
   = note: `#[warn(unused_unsafe)]` on by default

warning: function `on_signal` is never used
  --> src\cleanup_guard.rs:47:4
   |
47 | fn on_signal(guards: &mut GuardTable) {
   |    ^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: `jujutsu` (lib) generated 2 warnings
```
2023-04-30 15:18:30 +09:00
Martin von Zweigbergk
8395764de8 cargo: downgrade tracing from yanked 0.1.38 to 0.1.37 2023-04-29 22:59:52 -07:00
Martin von Zweigbergk
41a2855b4f README: add some pointers to the glossary 2023-04-28 11:02:28 -07:00
dependabot[bot]
3f1a454ba6 github: bump github/codeql-action from 2.3.1 to 2.3.2
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.3.1 to 2.3.2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](8662eabe0e...f3feb00acb)

---
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>
2023-04-28 09:13:05 -07:00
Yuya Nishihara
e9d2403696 index: use SmallVec to avoid lots of small allocations for adjacent lookup
I simply enabled all smallvec features that are covered by our MSRV.
https://docs.rs/smallvec/latest/smallvec/index.html#optional-features
2023-04-28 08:36:58 +09:00
Yuya Nishihara
d948acd5bf revset: do not scan ancestors more than once to evaluate nested children set 2023-04-28 08:36:58 +09:00
Yuya Nishihara
524db833f7 index: implement RevWalk that filters descendants with generation from roots
We could add `walk.descendants(root_positions)` method, and apply
`.filter_by_generation(range)`, but queue-based `.descendants()` would be
slower than the one using reachable set. So I didn't add such method.

I also considered reimplementing non-lazy version of this function without
using the current RevWalkGenerationRange, but it appears the current iterator
version performs well even if we have to do .collect_vec() and .reverse().
2023-04-28 08:36:58 +09:00
Yuya Nishihara
be5d380f2e index: add newtype to hide RevWalkIndex abstraction
I want to keep RevWalkIndex private, so I need to remove 'I: RevWalkIndex'
trait bound from the public types.
2023-04-28 08:36:58 +09:00
Yuya Nishihara
51683457c7 index: abstract CompositeIndex away from RevWalkQueue 2023-04-28 08:36:58 +09:00
Yuya Nishihara
8176f7d7b4 index: encapsulate ordering details in RevWalkQueue
This helps to extract a trait that abstracts CompositeIndex and descendants
map. Since the entry type E is a newtype wrapper, there wouldn't be runtime
cost.
2023-04-28 08:36:58 +09:00
Yuya Nishihara
e6740d9c3b index: migrate walk_ancestors_until_roots() from revset engine
I'm going to add a RevWalk method to walk descendants with generation filter,
which will use this helper method. RevWalk::take_until_roots() uses .min()
instead of .last() since RevWalk shouldn't know the order of the input set.
2023-04-28 08:36:58 +09:00
dependabot[bot]
6e8d0a0860 github: bump github/codeql-action from 2.3.0 to 2.3.1
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.3.0 to 2.3.1.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](b2c19fb9a2...8662eabe0e)

---
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>
2023-04-27 10:04:14 -07:00
dependabot[bot]
d741e5b352 cargo: bump pest_derive from 2.5.7 to 2.6.0
Bumps [pest_derive](https://github.com/pest-parser/pest) from 2.5.7 to 2.6.0.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.5.7...v2.6.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-27 10:03:58 -07:00
Yuya Nishihara
38e7eff09f index: merge overlapped generation ranges to be enqueued
Before, the number of the generations to track would increase at each merge
point. This was really bad for queries like ':@--' in merge-heavy history,
but I didn't notice the problem because ancestors query is lazy and
the default log template is slow. Since I'm going to reuse RevWalk for
'roots++:' queries, which can't be lazy, I need to fix this problem first.

As we don't have a revset expression to specify exact generation range,
gen.end is initialized to either 1 or close to u32::MAX. So, this change
means long-lived generation ranges will eventually be merged into one.
2023-04-27 08:18:47 +09:00
Yuya Nishihara
9a6a7c50db index: translate generation-filter range to item ranges
This allows us to merge overlapped ranges per entry.
2023-04-27 08:18:47 +09:00
Yuya Nishihara
c61d4e8404 index: extract constructor and helper methods of generation range walker 2023-04-27 08:18:47 +09:00
dependabot[bot]
a21b3d8c02 cargo: bump pest from 2.5.7 to 2.6.0
Bumps [pest](https://github.com/pest-parser/pest) from 2.5.7 to 2.6.0.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.5.7...v2.6.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-26 12:55:04 -07:00
dependabot[bot]
3391b217a8 cargo: bump tracing from 0.1.37 to 0.1.38
Bumps [tracing](https://github.com/tokio-rs/tracing) from 0.1.37 to 0.1.38.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-0.1.37...tracing-0.1.38)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-26 12:54:28 -07:00
Martin von Zweigbergk
1d5edddef7 docs: clarify that file() revsets match recursively 2023-04-25 14:57:57 -07:00
Yuya Nishihara
67d07751a5 tests: add basic test for undoing git import/export in non-colocated repo
If "jj op undo" doesn't roll back git refs (#1541), test_git_import_undo()
would get weird state. I think these tests are easier to follow than
test_git_fetch_undo() since no remote refs are involved.
2023-04-25 14:01:24 +09:00
Glen Choo
d165e931eb docs/design: propose submodule storage approach
This doc discusses the requirements of a submodule storage solution and
proposes a solution: storing submodules as full jj repos.
2023-04-24 14:29:47 -07:00
Glen Choo
562eebe213 WIP docs/design: describe submodule storage ideas and how to judge them
This doc describes what we need to consider in a submodule storage
solution, some possible solutions and what criteria we should use to
decide on a future direction.

This is still a WIP:

- The solutions are still underdescribed
- The actual evaluation of solutions is missing

Suggestions for the above are welcome :)
2023-04-24 14:29:47 -07:00
Martin von Zweigbergk
a19a91bfbc cargo: upgrade regex 1.7.3 to 1.8.1 2023-04-24 11:28:12 -07:00
dependabot[bot]
2c9d0577cf github: bump github/codeql-action from 2.2.12 to 2.3.0
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.12 to 2.3.0.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](7df0ce3489...b2c19fb9a2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-24 09:17:56 -07:00
dependabot[bot]
0eb4495ced cargo: bump tracing-subscriber from 0.3.16 to 0.3.17
Bumps [tracing-subscriber](https://github.com/tokio-rs/tracing) from 0.3.16 to 0.3.17.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-subscriber-0.3.16...tracing-subscriber-0.3.17)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-24 09:17:40 -07:00
Yuya Nishihara
837e8aa81a revset: add substitution rule for nested descendants/children
The substitution rule and tests are copied from ancestors/parents. The backend
logic will be reimplemented later. For now, it naively repeats children().
2023-04-24 20:45:13 +09:00
Yuya Nishihara
32253fed5e revset: replace children node with descendants of generation 1..2 2023-04-24 20:45:13 +09:00
Yuya Nishihara
a99b82c634 revset: add generation parameter to descendants node
This is a minimal change to replace Children with Descendants. A generation
parameter could be added to RevsetExpression::DagRange, but it's not needed
as of now.
2023-04-24 20:45:13 +09:00
Yuya Nishihara
f6570486e0 revset: add descendants node to expression, resolve it later
I'll add a substitution rule that folds (x+)+, and 'Descendants { roots }'
is easier to process than 'DagRange { roots, heads }'.
2023-04-24 20:45:13 +09:00
Yuya Nishihara
eadf8faded revset: extract children() evaluation to function
I'm going to add generation parameter to Children/DagRange nodes, and
'Children { .. }' will be substituted to 'DagRange { .., gen: 1 }'. This
commit helps future code move.

Lifetime bounds of the arguments are unnecessarily restricted. It appears
walk_ancestors_until_roots() captures arguments lifetime on rustc 1.64.0.
I think the problem will go away if walk_*() functions are extracted to
RevWalk methods where input arguments will become less generic.
2023-04-24 20:45:13 +09:00
Yuya Nishihara
d9d2b405e1 revset: remove redundant boxing from evaluated children node
Just spotted while moving codes around. This wouldn't matter in practice.
2023-04-24 20:45:13 +09:00
Yuya Nishihara
36e7afe0db revset: exclude unreachable roots from collect_dag_range() result
It doesn't matter, but can simplify the function interface. I'll probably
extract this function to RevWalk so the descendants with/without generation
filter can be tested without using revset API.
2023-04-24 20:45:13 +09:00
Yuya Nishihara
3b49eb8064 templates: rename "show" template alias to "builtin_log_detailed"
"jj show" is basically a "log" command with different defaults. We'll need
to consider this kind of stuff if we want to introduce namespace to templates.
2023-04-22 14:37:39 +09:00
Yuya Nishihara
feeacacb7b tests: rewrite default-command test to not depend on "show" template 2023-04-22 14:37:39 +09:00
Martin von Zweigbergk
366cee06c4 templates: extract default template to an alias
This way you can do `jj log -T 'default_log_template + "\n"'` to add a
blank line between commits.
2023-04-21 14:25:37 -07:00
dependabot[bot]
07a99cf3ee cargo: bump libc from 0.2.141 to 0.2.142
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.141 to 0.2.142.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.141...0.2.142)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-21 10:11:48 -07:00
dependabot[bot]
1c96d5c939 cargo: bump clap_complete from 4.2.0 to 4.2.1
Bumps [clap_complete](https://github.com/clap-rs/clap) from 4.2.0 to 4.2.1.
- [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.2.0...clap_complete-v4.2.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-21 10:11:32 -07:00
Martin von Zweigbergk
39e83b9f4a cli: move $JJ_VERSION out of CLI library
It should be up to the binary to decide which version it is. One
should be able to build the library without specifying a version.
2023-04-20 19:22:47 -07:00
Martin von Zweigbergk
6cb64bd255 tests: drop a few unnecessary --dry-run from tests
I think we should test actually performing the push when possible. I
think I initially used `--dry-run` because I thought it wasn't
possible to do local pushes with libgit2.
2023-04-19 22:56:51 -07:00
Aaron Bull Schaefer
6445ccea7b cli: use a unique file extension for description tempfiles
Establishing a unique file extension for the temporary files created
via `jj describe` helps to ensure that text editors can recognize the
filetype and alter settings accordingly. This will open the door for
an improved user experience, and allow for setting things like the
appropriate text-width/rulers, syntax highlighting of the diff summary
(see Git's commit tree-sitter grammer [1]), easy toggling of the `JJ:`
comment lines, etc.

I examined the behavior of filetype detection across a number of
common text editors, and the most universally-support mechanism was
to have a unique extension that does not include any periods. Meaning
that namespacing via something like `.jj.txt` instead, won't always be
detected due to inconsistent matching prioritization across editors.
It also makes sense to assume that we may want other Jujutsu-specific
filetypes in the future.

The filename prefix has also been switched to be `editor-` for clarity,
as well as to ease matching a glob-pattern if we ever need to garbage
collect leftover tempfiles. This structure is similar to what Mercurial
and Sapling do as well.

[1] https://github.com/the-mikedavis/tree-sitter-git-commit
2023-04-18 18:35:19 -07:00
Martin von Zweigbergk
c60f14899a index: remove entry_by_id() from trait
It no longer needs to be on the `Index` trait, thereby removing the
last direct use of `IndexEntry` in the trait (it's still used
indirectly in `walk_revs()`).
2023-04-18 18:32:23 -07:00
tp-woven
831c45539e Fix small typo 2023-04-18 18:03:05 +09:00
Martin von Zweigbergk
e65b8c3cad docs: add a glossary
The need for a glossary came up on Discord today.

This needs some more work, but I think this is a good start. I'm still
happy to update it if anyone has suggestions, of course. I haven't
started sprinkling pointers to the glossary from other places, so
users will only discover it by browsing the `docs/` directory.
2023-04-17 16:48:23 -07:00
Aaron Bull Schaefer
6c627fb30d cli: default to log when no subcommand is provided
This is a convenience optimization to improve the default user
experience, since `jj log` is a frequently run command. Accessing the
help information explicitly still follows normal CLI conventions, and
instructions are displayed appropriately if the user happens to make a
mistake. Discoverability should not be adversely harmed.

Note that this behavior mirrors what Sapling does [2], where `sl` will
display the smartlog by default.

[1] https://github.com/clap-rs/clap/issues/975
[2] https://sapling-scm.com/docs/overview/smartlog
2023-04-17 16:30:42 -07:00
Martin von Zweigbergk
e056474fe8 tests: fix a typo 2023-04-17 16:14:14 -07:00
dependabot[bot]
c7b66606a1 cargo: bump git2 from 0.17.0 to 0.17.1
Bumps [git2](https://github.com/rust-lang/git2-rs) from 0.17.0 to 0.17.1.
- [Release notes](https://github.com/rust-lang/git2-rs/releases)
- [Changelog](https://github.com/rust-lang/git2-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/git2-rs/compare/git2-curl-0.17.0...0.17.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-17 09:19:58 -07:00
Ilya Grigoriev
e448198530 contributing.md: docs on working with protos 2023-04-16 22:04:27 -07:00
Ilya Grigoriev
7d9faef95f contributing.md: Fix up the MSRV, explain it a bit more 2023-04-16 22:04:27 -07:00