Commit graph

3209 commits

Author SHA1 Message Date
Martin von Zweigbergk
b11d38fdf8 revset: delete obsolete comment about ambiguous change/commit ids
Commit ids and change ids or prefixes of either are never ambiguous
since we started using k-z for change ids.
2023-05-03 16:23:14 -07:00
Martin von Zweigbergk
9cf0440aef revset: elide some lifetimes (reported by IntelliJ) 2023-05-03 16:23:14 -07:00
Martin von Zweigbergk
9c91f8190d tracing: bump a few trace events from DEBUG to INFO
Now that we don't print INFO-level events by default, we can start
using that level.
2023-05-03 11:40:23 -07:00
Martin von Zweigbergk
9a942b98f8 cli: show only ERROR-level tracing events by default
By setting a higher level by default, we open up to using the other
tracing levels without spamming the user.

I'm not sure if we should set it to ERROR or OFF by default, we let's
try ERROR for now. It shouldn't make any difference since we don't
have any ERROR-level events yet.
2023-05-03 11:40:23 -07:00
Yuya Nishihara
f8d56e816d cli: print parent commit summary on checkout
On "jj checkout", description of the working-copy commit is empty, and the
working-copy parent provides more information. It might be a bit verbose to
print parent summary on every history rewriting, but I think that's okay.
2023-05-02 15:04:13 +09:00
dependabot[bot]
c55a323318 cargo: bump dirs from 5.0.0 to 5.0.1
Bumps [dirs](https://github.com/soc/dirs-rs) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/soc/dirs-rs/releases)
- [Commits](https://github.com/soc/dirs-rs/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-01 16:14:23 +00:00
Grégoire Geis
b08e508ee5 Canonicalize cwd in CommandHelper::new()
`workspace_root` is [canonicalized](41a2855b4f/lib/src/workspace.rs (L119)), but `cwd` [isn't](41a2855b4f/src/cli_util.rs (L581)). When [working with relative paths](41a2855b4f/src/cli_util.rs (L749-L760)), this leads to issues in Windows: canonicalized paths start with `\\?\`, whereas non-canonicalized paths do not. Therefore, paths were formatted canonicalized, and commands did not accept non-canonicalized paths:

```
$ jj st
Parent commit: bdb62c9 canonicalize cwd in cli_util.rs
Working copy : 059c104379cd (no description set)
Working copy changes:
A \\?\C:\github.com\71\jj\.vscode\launch.json

$ jj diff .vscode\launch.json
Error: Path ".vscode\launch.json" is not in the repo

$ jj diff \\?\C:\github.com\71\jj\.vscode\launch.json
Added regular file \\?\C:\github.com\71\jj\.vscode\launch.json:
...
```

With this change:
```
$ jj st
Parent commit: bdb62c9 canonicalize cwd in cli_util.rs
Working copy : 059c104379cd (no description set)
Working copy changes:
A .vscode\launch.json

$ jj diff .vscode\launch.json
Added regular file .vscode\launch.json:
...
```
2023-05-02 00:48:26 +09:00
Grégoire Geis
fe653f430e Make tests run on windows-gnu 2023-05-01 13:48:40 +09:00
Grégoire Geis
335d9a9f5e Fix warnings in tests on non-Unix platforms 2023-05-01 13:37:31 +09:00
Martin von Zweigbergk
3ceb2b7c12 cli: make jj squash nonexistent warn
This adds a check similar to that for `jj log`, so e.g. `jj squash @`
warns that the `@` argument is interpreted as path.
2023-04-30 07:29:19 -07:00
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