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

2190 commits

Author SHA1 Message Date
Martin von Zweigbergk
9d040fef78 docs: indent conflict marker examples to not confuse tools
When importing `conflicts.md` into the Google repo, our internal tools
complained that it contained conflict markers. Similarly, if you ever
get an actual merge conflict in the file, the working-copy
snapshotting would parse our sample conflict markers here, forcing you
to work around it. Let's avoid that by indenting the conflict
markers. Hopefully readers will understand that the leading space is
not part of the markers.
2022-12-12 16:20:40 -08:00
Yuya Nishihara
4a889b986c index: implement generation filter on RevWalkGenerationRange
This will be a building block of 'parents(base)' revset. 'base---' will
be .filter_by_generation(3..4) for example. I think 'ancestors(base)' can
also have an optional generation parameter, but I haven't considered any
particular syntax yet.
2022-12-11 13:14:19 +09:00
Yuya Nishihara
832cf8d838 index: add RevWalk variant that tracks generation
Even though I couldn't determine if RevWalkGenerationRange has a measurable
cost compared to RevWalk, I'm not comfortable with enabling generation
tracking by default. So this patch adds a separate struct. I duplicated
Iterator::next() method as it seemed rather complicated to extract a common
iterator wrapper.

Actual filtering function and tests will be added by the next commit.
2022-12-11 13:14:19 +09:00
Yuya Nishihara
4740d7fac1 index: add slot to track state of wanted RevWalk items
RevWalkWorkItem<u32> to track generation for example.
2022-12-11 13:14:19 +09:00
Yuya Nishihara
03eff13d52 index: extract a couple of RevWalk helper functions to inner struct 2022-12-11 13:14:19 +09:00
Yuya Nishihara
a124f84949 index: move core RevWalk logic to inner struct
I'll add a RevWalk that can filter entries by generation range.
2022-12-11 13:14:19 +09:00
Waleed Khan
91ead75e43 feat(branch): support jj branch forget --glob 2022-12-10 16:51:10 -08:00
Waleed Khan
cd1e27a037 cleanup: alphabetize Cargo.toml 2022-12-10 16:51:10 -08:00
Martin von Zweigbergk
29db672a5c tutorial: mention jj edit and when it's useful
I made some other little touchups while at it.

Closes #840
2022-12-09 22:28:33 -08:00
Danny Hooper
6787e17254 Do not use "..." between diff chunks when it only replaces 1 line of the diff
The number of lines in the diff output is unchanged.

This makes diffs a little more readable when the "..." would otherwise hide a
single line of code that helps in understanding the surrounding context lines.

This change mostly rearranges the loop that consumes the diff lines, so it can
buffer up to num_context_lines*2+1 lines instead of just num_context_lines.
There's a bit of extra code to handle times when a "..." replaces the last line
of a diff.

Note that `jj diff --git` is unchanged, and will still output `@@` lines that
replace a single line of context.
2022-12-09 20:39:40 -06:00
dependabot[bot]
15d40ffa54 github: bump github/codeql-action from 2.1.35 to 2.1.36
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.35 to 2.1.36.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](b2a92eb56d...a669cc5936)

---
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>
2022-12-09 11:09:59 -08:00
Martin von Zweigbergk
2a1c2e05ba cli: when colocated with Git, export refs on snapshot
This fixes the bug described in the previous commit.

Because we now print the message about failed exports also while
snapshotting, we may end up reporting it twice on one command. I'm not
sure it's worth worrying about that. We can deal with that later if it
turns out to be a common complaint.
2022-12-08 23:10:18 -08:00
Martin von Zweigbergk
217883591b git: demonstrate how branches don't get exported on snapshot
If a branch points to the working-copy commit, it will automatically
get updated when the working copy is snapshotted. However, it turns
out that we don't automatically export the change to Git when running
in a colocated working copy (nor in a non-colocated working copy, but
that shouldn't be surprising). The change will not get exported until
a non-snapshot operation runs. We noticed this bug in @hooper's repo
today.
2022-12-08 23:10:18 -08:00
Martin von Zweigbergk
1dbf4df3ea docs: mention that the "view" object knows about all workspaces
I seem to have forgotten to update this when I added support for
workspaces a while back.

I made some other little touchups while at it.
2022-12-08 17:30:29 -08:00
Martin von Zweigbergk
79d6779995 github: make Scorecard security scanner not use access token
Google's security team asked us to remove this use of a PAT. It's
apparently supposed to work without it, it's just that it won't be
able to check that we have bronch protection set up.
2022-12-08 14:54:28 -08:00
Yuya Nishihara
a569ac07f6 revset: alias 'empty()' to '~file(*)'
We're more likely to filter out empty commits, so this should be slightly
faster in practice.

The extra Option<> isn't needed, but it should clarify that "prefix([])"
is not "everything".
2022-12-07 23:38:17 +09:00
Yuya Nishihara
1eaa05b6fd revset: remove uninteresting expressions early
Since internalize_filter() should no longer insert redundant 'all() & x'
nodes, it's simpler to clean up uninteresting nodes first.
2022-12-07 23:38:17 +09:00
Yuya Nishihara
75e072b80c revset: remove stale comment about filter intersection with 'all()'
This should have been removed at e17fc89a8d "revset: make filter node unary,
move candidates to outer intersection".
2022-12-07 23:38:17 +09:00
Yuya Nishihara
222d9a6527 revset: rewrite 'x ~ y' to 'x & ~y' first to apply filter optimization
This is remainder of 48d10d648c "revset: add unary negate (or set
complement) operator '~y'".
2022-12-07 23:38:17 +09:00
Yuya Nishihara
b6e06f6dc9 cli: use deserialize to parse alias definition
Unfortunately, config::Value is lax and '[7]' could be parsed as '["7"]'.
I don't like it, but I think that's actually better for consistency as we
use config.get_string() in various places.
2022-12-07 23:26:11 +09:00
Yuya Nishihara
283231b1e4 cli: load all aliases to map first to suppress cryptic error
Otherwise 'jj foo.' would fail with 'Config error: Char'.
2022-12-07 23:26:11 +09:00
Yuya Nishihara
a45e00179c cli: on clone, turn local git remote to absolute path
Otherwise a subsequent git fetch would fail.
2022-12-07 14:14:31 +09:00
Herby Gillot
d530b34568 readme: add MacPorts install info
https://ports.macports.org/port/jujutsu/
2022-12-06 20:46:47 -08:00
Yuya Nishihara
951eb0b61a revset: use filter intersection for tree containing filter
This basically transforms 's1 & (f() | s2)' to
's1.iter().filter(all && f || s2)'. Still the predicate part includes "all",
the filter function doesn't need to load commit data for every entry since
's1.iter().filter(all)' is tested first. To optimize "all" predicate out,
maybe we can add a wrapper that returns '|_: &IndexEntry| true'.

Instead of inserting AsFilter(_) node, I could add a recursive is_filter()
function. That would also work so long as the height of RevsetExpression tree
is limited. I chose node insertion just for ease of snapshot testing.
2022-12-07 11:01:59 +09:00
Yuya Nishihara
f2e7a5ad03 revset: introduce trait that turns evaluated revset into predicate function
This allows us to evaluate 's1 & (f() | s2)' as 's1.iter().filter(f || s2)'
instead of 's1 & (all.iter().filter(f) | s2)'.
2022-12-07 11:01:59 +09:00
Yuya Nishihara
f64f96251f revset: add basic tests for revset combinator
I've made MutableIndex::add_commit_data() crate-public since it's convenient
to build an IndexEntry by that function.
2022-12-07 11:01:59 +09:00
dependabot[bot]
5834a1b191 cargo: bump pest_derive from 2.5.0 to 2.5.1
Bumps [pest_derive](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_derive
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-06 08:11:18 -08:00
dependabot[bot]
ed7908e9ed cargo: bump zstd from 0.12.0+zstd.1.5.2 to 0.12.1+zstd.1.5.2
Bumps [zstd](https://github.com/gyscos/zstd-rs) from 0.12.0+zstd.1.5.2 to 0.12.1+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>
2022-12-06 08:10:53 -08:00
Ilya Grigoriev
581cdad1b0 Upgrade insta from 1.21.2 to 1.22.0 2022-12-05 22:29:05 -08:00
Ilya Grigoriev
9e334de7d6 Remove insta::assert_snapshot that causes a failure with insta 1.22 2022-12-05 22:29:05 -08:00
Martin von Zweigbergk
5caade2705 release: release version 0.6.1
The only changes is that we now depend on a released version of
`thrift`.
2022-12-05 20:50:48 -08:00
Martin von Zweigbergk
dfde44255c cargo: depend on now-released thrift 0.17.0
This should let us publish our crates to crates.io.
2022-12-05 20:50:48 -08:00
Martin von Zweigbergk
f5fc3c35f5 github: disable broken attempt to auto-merge Dependabot PRs again
Sigh, I thought it was fixed now, but it seems it's only `gh pr ready`
that works with `GITHUB_TOKEN`. This rolls back commit ee7e7e1b62.
2022-12-05 14:23:43 -08:00
Martin von Zweigbergk
80ccfa8bcc release: release version 0.6.0
Lots of new features and important bugfixes. Thanks, everyone!
2022-12-05 10:38:56 -08:00
Pranay Sashank
d9f1ada69a Add legacy-thrift feature to nix flake. 2022-12-06 00:05:46 +05:30
dependabot[bot]
9a36f1d6e3 github: bump github/codeql-action from 2.1.32 to 2.1.35
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.32 to 2.1.35.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](4238421316...b2a92eb56d)

---
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>
2022-12-05 10:07:43 -08:00
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