Commit graph

6421 commits

Author SHA1 Message Date
Martin von Zweigbergk
dddba4675d dag_walk: heads: use bfs and terminate if frontier has single item
We use `heads_ok()` for finding the head operations when there are
multiple current op heads. The current DFS-based algortihm needs to
always walk all the way to the root. That can be expensive when the
operations are slow to retrieve. In the common case where there are
two operations close to each other in the graph, we should be able to
terminate the search once we've reached the common ancestor. This
patch replaces the DFS by a BFS and adds the early termination.
2024-06-25 05:59:20 +09:00
Martin von Zweigbergk
22217424f5 dag_walk: heads: rename reachable to heads
The name `reachable` feels backwards to me since it keeps track of
inputs that are not reachable from other inputs.
2024-06-25 05:59:20 +09:00
Martin von Zweigbergk
c52a2169d8 cargo: update off of yanked version of subtle 2024-06-25 05:48:45 +09:00
dploch
1a78ba5eaf copy-info: initial design doc 2024-06-24 13:26:12 -04:00
dependabot[bot]
a4ecf4c1c0 cargo: bump syn from 2.0.67 to 2.0.68 in the cargo-dependencies group
Bumps the cargo-dependencies group with 1 update: [syn](https://github.com/dtolnay/syn).


Updates `syn` from 2.0.67 to 2.0.68
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.67...2.0.68)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-24 18:52:05 +02:00
mlcui
6ae4f45838 cli: Ignore immutable() in jj git push conflict/desc/user checks
Fixes #3029.
2024-06-24 10:45:29 +10:00
Yuya Nishihara
297a0ebb68 cli: stop using shared id prefix context to compute immutable heads
It's unlikely that the immutable set is defined by short hashes, and more
importantly, the cache must not be initialized by using tx.repo().
2024-06-24 09:16:15 +09:00
James Sully
f8e106a194 cli: git: add jj git remote set-url command 2024-06-23 12:31:43 +10:00
Yuya Nishihara
3c80e3453d cli: branch: make "set" do upsert as before
Since "set <thing>" often adds a <thing> if not exists, it make some sense
that "branch set" does upsert. The current "branch set" use case is now covered
by "branch move", so it's okay to change the "set" behavior.

If new branch is created by "branch set", status message and hint will be
printed to help migration. The user should be able to undo creation if it was
a mistake.

Closes #3584
2024-06-23 09:44:38 +09:00
Yuya Nishihara
9dd8477f73 cli: sort operation subcommands 2024-06-23 09:43:30 +09:00
Yuya Nishihara
ebe97e3a9b cli: remove unneeded "pub" from "op undo" mode type and constant
Maybe we don't care, but let's make them private as all users and helper
functions are private.
2024-06-23 09:43:30 +09:00
Yuya Nishihara
b72f2827d0 cli: move cmd_operation() dispatcher fn next to type definition 2024-06-23 09:43:30 +09:00
Martin von Zweigbergk
15e0d62380 cli: split up commands/operation.rs into one file per command 2024-06-22 08:49:02 +09:00
Martin von Zweigbergk
3db183b4c5 prev: make revset code more similar to next 2024-06-22 04:48:29 +09:00
Martin von Zweigbergk
49b76cbd8c next/prev: fix a few bugs in --conflict 2024-06-22 04:48:29 +09:00
Martin von Zweigbergk
d8cd38a3a8 next: make test cases test what they were supposed to 2024-06-22 04:48:29 +09:00
Martin von Zweigbergk
741fa8dfe2 next: add a test for jj next --edit on a head 2024-06-22 04:48:29 +09:00
Martin von Zweigbergk
8aeb9a8ea8 next/prev: include graph in --conflict tests, highlighting bugs
There are several bugs in both the tests and in the implementation
that are made more clear by showing the log output before and after
running the command.
2024-06-22 04:48:29 +09:00
dependabot[bot]
0a402a28a0 cargo: bump the cargo-dependencies group with 2 updates
Bumps the cargo-dependencies group with 2 updates: [proc-macro2](https://github.com/dtolnay/proc-macro2) and [syn](https://github.com/dtolnay/syn).


Updates `proc-macro2` from 1.0.85 to 1.0.86
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.85...1.0.86)

Updates `syn` from 2.0.66 to 2.0.67
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.66...2.0.67)

---
updated-dependencies:
- dependency-name: proc-macro2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-21 17:55:29 +02:00
Yuya Nishihara
ddeb10b3f3 cli: branch: drop support for deprecated --glob option
It's been 8 months since the option got deprecated by 8dbe12da2a.
2024-06-21 09:43:23 +09:00
Yuya Nishihara
adcd78a0b7 cli: sort config/sparse subcommands in lexicographical order 2024-06-21 09:43:14 +09:00
Yuya Nishihara
78dba90ac8 cli: sort match arms in run_command() 2024-06-21 09:43:14 +09:00
Yuya Nishihara
ef9633135e cli: rename derived_subcommands to subcommand, remove redundant type annotation
I don't think "derived" here makes much sense.
2024-06-21 09:43:14 +09:00
Yuya Nishihara
20f1ba5a08 cli: rename "sub_args" variables to "args"
Just for consistency.
2024-06-21 09:43:14 +09:00
Yuya Nishihara
026d83b61f cli: rename SparseArgs to SparseCommand 2024-06-21 09:43:14 +09:00
Philip Metzger
de022aeaa7 next/prev: Implement next/prev --conflict
This allows users to jump to the next conflict in the ancestors or children of 
the start commit.

Continues work on #2126

Co-Authored-By: Noah Mayr <dev@noahmayr.com>
2024-06-20 23:29:41 +02:00
Philip Metzger
0d9000271e lib: Add RevsetExpression::filtered().
This allows users to easily filter a commit range by conflicts, which will be needed for `next/prev`
further down in the next commit. Users which benefit from it were also migrated.
2024-06-20 23:29:41 +02:00
Matt Kulukundis
c9b3d64ce5 Add background snapshotting info to debug watchman status. 2024-06-20 16:09:06 -04:00
Austin Seipp
397e96f9ae cli: let jj git push --change handle large revsets
In a repo of mine I wanted to do something like the following to push all of my
leaves to the remote as backup:

    jj git push -c 'all:heads(base::) & mine() ~ empty()'

But couldn't, because `jj git push` doesn't handle large revsets, even though
it does handle multiple `-c` arguments, so I had to work out some pipe-to-xargs
command instead.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-06-20 11:40:55 -05:00
Austin Seipp
aab82cd641 cli: print out short change ids with jj git push --change
The follow up diff will make `-c` accept large revsets, so it won't make any
sense to print out the original expression when multiple branches will be
created from it.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-06-20 11:40:55 -05:00
Yuya Nishihara
5988a00ae4 cli: branch: reject empty branch name consistently by "set"
Though "branch set" can't create new branch, this should provide a better error
message.
2024-06-20 17:00:34 +09:00
Yuya Nishihara
d4e64c46b4 cli: branch: remove trailing period from command/arg summary lines
That's the convention of clap.
2024-06-20 17:00:34 +09:00
Yuya Nishihara
844e6684bd cli: branch: remove inconsistent "pub"s from Args fields 2024-06-20 17:00:34 +09:00
Yuya Nishihara
d640645d7b cli: branch: sort cmd_branch() match arms 2024-06-20 17:00:34 +09:00
Yuya Nishihara
d2d0041333 cli: branch: rename local sub_args to args
There are no other "args" in this context.
2024-06-20 17:00:34 +09:00
Yuya Nishihara
b9c2daa408 cli: branch: move command fn next to Command/Args type 2024-06-20 17:00:34 +09:00
Yuya Nishihara
9e35b9b218 cli: branch: split to per-command module files
This is another big subcommand module. Let's split it up.

I'm not a big fan of r#move syntax, but we already have one in src/commands,
so there's no point to avoid it.
2024-06-20 17:00:34 +09:00
Martin von Zweigbergk
494de23ea5 revset: clarify error about missing working-copy commit for workspace
The error message that says something like 'Workspace "default"
doesn't have a working copy' confused me when I saw it. The problem
it's describing is that the repo view doesn't have a working-copy
commit for the given workspace id. Saying "working-copy commit"
instead of "working copy" hopefully clarifies it a bit.
2024-06-20 16:21:58 +09:00
Yuya Nishihara
68b8b1a6a6 cli: rename "debug workingcopy" to "debug working-copy"
I think "working-copy" is more readable. It's a debug command, so we can freely
rename it.
2024-06-20 09:55:18 +09:00
Yuya Nishihara
567f0db734 cli: move cmd_git() dispatcher function next to GitCommand enum 2024-06-20 09:55:18 +09:00
Yuya Nishihara
e5a3d6a2ba cli: sort debug/git subcommands lexicographically 2024-06-20 09:55:18 +09:00
Matt Kulukundis
33ab8d4371 cli: Add an option to diff to output only paths. 2024-06-19 20:27:51 -04:00
Yuya Nishihara
f8b87f6499 diff: rewrite find_line/nonword_ranges() by using iterator adapters
I don't think .scan() is descriptive name, but it looks slightly better than
placing accumulator out of the closure.
2024-06-20 08:46:26 +09:00
Yuya Nishihara
5f2f13a876 diff: simply pass tokenizer Fn by value 2024-06-20 08:46:26 +09:00
Austin Seipp
be411de8f6 cargo: run full cargo update
Reissue of https://github.com/martinvonz/jj/pull/3892 now that we have updated
to `watchman_client` 0.9, which should fix this issue based on reading the
source code.
2024-06-19 18:38:26 -05:00
Martin von Zweigbergk
31b8f07fa0 docs: hyphenate "community-built" 2024-06-20 05:34:02 +09:00
Martin von Zweigbergk
2cdb767991 docs: explain that jj was started 3 years before Sapling announcement
Someone at work asked me why I started jj when Sapling already
existed. Let's clarify that I started it before.
2024-06-20 05:24:28 +09:00
Martin von Zweigbergk
9257d0946e docs: use bullet lists in revset examples to save vertical space 2024-06-20 05:21:03 +09:00
Matt Kulukundis
3e7ad4d23c Add jj debug snapshot command and use it in trigger
The command only takes a snapshot and avoids other overhead, so it can
be used as a target for the watchman trigger that gets installed.
2024-06-19 11:30:27 -04:00
Martin von Zweigbergk
3ebad154ca docs: add examples for some revset functions too 2024-06-19 19:57:22 +09:00