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

1120 commits

Author SHA1 Message Date
Martin von Zweigbergk
971ca0511b cli: fix formatting of jj help rebase
I think I lost the formatting in the upgrade to clap 3.0.
2022-04-08 18:52:00 -07:00
dependabot[bot]
d9c8f49d91 github: bump github/codeql-action from 2.1.7 to 2.1.8
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.7 to 2.1.8.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](0182a2c78c...1ed1437484)

---
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-04-08 08:46:41 -07:00
Waleed Khan
672f9e85cb github: remove complete directory for releases
This directory doesn't seem to do anything.
2022-04-08 06:08:32 -07:00
dependabot[bot]
f0538a1d06 github: bump cachix/install-nix-action from 16 to 17
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 16 to 17.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](d56f3ce9be...d64e055310)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-07 09:26:26 -07:00
Martin von Zweigbergk
a4449cd7bc tests: add tests for jj squash -i 2022-04-06 23:31:28 -07:00
Martin von Zweigbergk
3aa153fb59 tests: add tests for jj squash 2022-04-06 23:31:28 -07:00
Martin von Zweigbergk
3d8d0bea71 tests: add tests for jj move -i 2022-04-06 23:31:28 -07:00
Martin von Zweigbergk
dc41c4bfe4 tests: add tests of jj move 2022-04-06 23:31:28 -07:00
Martin von Zweigbergk
696a583e4e tests: add tests for jj edit on merge commit 2022-04-06 23:31:28 -07:00
Martin von Zweigbergk
066f74a1b4 tests: check set of files passed to diff-editor in jj edit 2022-04-06 23:31:28 -07:00
Martin von Zweigbergk
3907677c51 tests: add tests for jj edit
These tests are very similar to the `jj restore -i` tests because `jj
edit -r $REV` is a specialized version of `jj restore -i --from $REV-
--to $REV` on non-merge commits.
2022-04-06 23:31:28 -07:00
Martin von Zweigbergk
7a013a59ae cli: add a command for printing the contents of a file in a revision
I'm adding this mostly because it's useful for testing. That's also
the reason it supports displaying conflicts. I didn't call it `cat`
like `hg cat` because I haven't found `hg cat` on multiple files
useful.
2022-04-06 23:31:28 -07:00
dependabot[bot]
243836ebf3 github: bump github/codeql-action from 2.1.6 to 2.1.7
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.6 to 2.1.7.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](28eead2408...0182a2c78c)

---
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-04-06 09:46:28 -07:00
Yuya Nishihara
46d96c5a9e cli: extract function that maps settings and command options to diff format
This removes the ui dependency from show_diff(), and clarifies that the
formatter argument is the output stream.

We might eventually trun DiffFormat into a struct, but it's an enum for
now.
2022-04-06 09:46:14 -07:00
Yuya Nishihara
0003c36dfc cli: rename DiffFormat struct to DiffFormatArgs
This avoids future name conflicts. I want to extract the Format enum from
show_diff().
2022-04-06 09:46:14 -07:00
Yuya Nishihara
cff611b481 cli: move Ui::format_file_path() to WorkspaceCommandHelper
With this change, we can eliminate (some of) the ui argument from diff
functions.

parse_file_path() can also be moved to WorkspaceCommandHelper, but I'm
yet to be sure how to reorganize it and matcher builder.
2022-04-06 09:46:14 -07:00
Yuya Nishihara
6c3ec03b72 cli: pass &WorkspaceCommandHelper around diff functions
This prepares for the removal of the ui argument from diff functions. I
think it's a bit confusing that these functions take (ui, formatter)
parameters since both ui/formatter can be output stream.

Ui::format_file_path() will be moved to WorkspaceCommandHelper.

show_git_diff() doesn't need WorkspaceCommandHelper as of now, but I've
also changed its signature for consistency. If we add an option to specify
path formatting of git diff for example, we'll probably need the command
helper.
2022-04-06 09:46:14 -07:00
dependabot[bot]
028e6106f5 cargo: bump config from 0.12.0 to 0.13.0
Bumps [config](https://github.com/mehcode/config-rs) from 0.12.0 to 0.13.0.
- [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.12.0...0.13.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-04 09:06:47 -07:00
Martin von Zweigbergk
6efa47814a release: release version 0.4.0
This release is mostly about the fix for #177, which looks pretty bad
even though I think it is actually harmless. It also has `jj log -p`
contributed by @yuja!
2022-04-02 23:35:15 -07:00
Martin von Zweigbergk
28916ceb19 cli: in help output, list global options under separate heading
I've found it hard to read the `jj help` output because command
options are mixed with global options. This patch fixes that by
putting global options under a separate heading.
2022-04-02 14:57:48 -07:00
Martin von Zweigbergk
f21a069a47 tests: add tests for jj restore -i 2022-04-02 14:22:58 -07:00
Martin von Zweigbergk
d37cb530ec tests: add tests for jj restore 2022-04-02 14:22:58 -07:00
Martin von Zweigbergk
9b44822dc1 tests: add helper for failing tests as well 2022-04-02 14:22:58 -07:00
Martin von Zweigbergk
6344faa3fe tests: allow setting env var for all commands in TestEnvironment
Sometimes it's useful to have an environment variable set for all
commands in a test. This patch lets you do that by adding environment
variables to the `TestEnvironment` itself. These will then be set on
all subsequent commands.
2022-04-02 14:22:58 -07:00
Martin von Zweigbergk
257b85a1b5 test: add helper for writing config file to TestEnvironment 2022-04-02 14:22:58 -07:00
Martin von Zweigbergk
e7648b6342 tests: add tests for jj diff 2022-04-02 14:22:58 -07:00
Martin von Zweigbergk
710d51c45b tests: move testutils from src/ to tests/ 2022-04-02 14:22:58 -07:00
dependabot[bot]
47bdffed34 cargo: bump clap from 3.1.6 to 3.1.8
Bumps [clap](https://github.com/clap-rs/clap) from 3.1.6 to 3.1.8.
- [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/v3.1.6...v3.1.8)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-01 09:06:37 -07:00
Martin von Zweigbergk
16994308fa git: remove code for upgrading from Git notes 2022-03-31 13:32:43 -07:00
Martin von Zweigbergk
600aad62f4 tests: extract some variables for repeated expressions 2022-03-31 10:23:33 -07:00
Martin von Zweigbergk
f16d2a237b backend: pass in path when reading/writing conflicts as well
We do it for all the other kinds of objects already. It's useful to
have the path for backends that store objects by path (we don't have
any such backends yet). I think the reason I didn't do it from the
beginning was because we had separate `RepoPath` types for files and
directories back then.
2022-03-31 10:23:33 -07:00
Martin von Zweigbergk
fd5bc7966c tests: pass around &RepoPath instead of &str in working copy test
This is a leftover from when there were separate `RepoPath` types for
directories and files.
2022-03-31 10:23:33 -07:00
Martin von Zweigbergk
034fbb47e3 cli: fix crash when initializing workspace colocated with Git repo
When initializing a workspace that shares its working copy with a Git
repo (i.e. `jj init --git-repo=.`), we import refs and HEAD when
creating the `WorkspaceCommandHelper` (as we do for all commands when
the working copy is shared). That makes the explicit import we do in
`cmd_init()` unnecessary. It also makes the checkout of HEAD I added
for the fix of #102 unnecessary. More importantly, as @yuja reported
in #177, it makes the command crash (at least if the repo is small
enough that the two checkouts happen within a second). I think the
problem is that the second checkout tries to create the same commit
except that the Change ID is different (the problem is not the
predecessors as I speculated in the issue tracker). The fix is to
simply avoid doing the redundant work. We still need a proper fix for
#27 eventually.

Closes #177.
2022-03-30 22:09:55 -07:00
Martin von Zweigbergk
a9d1b16937 workspace: canonicalize workspace and repo paths internally
We depend on comparing the workspace root with the Git repo's path to
know if we're sharing the working copy with it. For that to work
reliably, we need the paths to be canonicalized, so that's what this
patch tries to do.
2022-03-30 22:09:55 -07:00
Martin von Zweigbergk
197f669976 cli: fix git-colocated working copy on Windows
This patch adds a very simple e2e test of having a working copy shared
with Git. The test initially failed on Windows. The symptom was that
the "master" branch did not get updated when we create a commit using
`jj`. That suggested that we didn't correctly detect that the working
copy was shared. After a lot of troubleshooting, I think I mostly
understand what we going on here (thanks to @arxanas for suggesting
https://github.com/mxschmitt/action-tmate). The path we get from
`git2::Repository::workdir()` seems to not be canonicalized in the
same way as `std::fs::canonicalize()` canonicalizes. Specifically, it
does not have the "\\?\" prefix we get from that function. I suppose
that's because libgit2 is a C library and canonicalizes the path using
some other system call.
2022-03-30 22:09:55 -07:00
Martin von Zweigbergk
6cd4e03c25 cleanup: use canonicalize() method instead of free function
I had somehow not noticed that `Path` and `PathBuf` have
`canonicalize()` methods. Using them saves a few characters of code.
2022-03-30 22:09:55 -07:00
Martin von Zweigbergk
2c0b296f35 cli: remove TODO addressed in f6ba34f3c3 2022-03-30 22:09:55 -07:00
Yuya Nishihara
a7e3269ed8 log: add -p/--patch option to show diff along with commit meta data
"log -p | less" is the option I often use with hg/git to find interesting
bits from the changelog, and I think it's also valid with jj. Unlike
"hg log -p --stat", "jj log -p --summary" does not show both diff summary
and patch to reflect the internal structure. This behavoir is arguable and
may be changed later.

The logic of show_patch() is extracted from cmd_show().
2022-03-30 16:24:34 -07:00
Yuya Nishihara
9923bab3ba diff: pass formatter to show_diff() as argument
We might want to split show_diff() into config/option handling part and
diff displayer function, but I'm not sure. Since some of the show_diff
functions depends on ui, we can't isolate show_diff() from the ui object
anyway.

  let opts = parse_diff_option(ui, args);  // map config/option to diff opts
  show_diff(ui, formatter, opts, ...);  // would be nice if ui could be removed
2022-03-30 16:24:34 -07:00
Yuya Nishihara
c2fe008817 diff: pass formatter to show_diff child functions as argument
This decouples the output stream from the ui.
2022-03-30 16:24:34 -07:00
Yuya Nishihara
71e29792f6 diff: make show_diff_summary() reuse locked stdout formatter
This parepares for "log --patch" option, where the formatter will be passed
as a function argument. Unlike diff/show, graphlog needs a temporary output
buffer per commit.
2022-03-30 16:24:34 -07:00
dependabot[bot]
e34dfe00df github: bump github/codeql-action from 1.1.5 to 2.1.6
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 1.1.5 to 2.1.6.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](8834766498...28eead2408)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-30 09:32:32 -07:00
dependabot[bot]
e7767002b6 cargo: bump insta from 1.13.0 to 1.14.0
Bumps [insta](https://github.com/mitsuhiko/insta) from 1.13.0 to 1.14.0.
- [Release notes](https://github.com/mitsuhiko/insta/releases)
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/insta/compare/1.13.0...1.14.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-28 08:54:08 -07:00
dependabot[bot]
d8b7d2269d cargo: bump test-case from 2.0.1 to 2.0.2
Bumps [test-case](https://github.com/frondeus/test-case) from 2.0.1 to 2.0.2.
- [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.0.1...v2.0.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-28 08:53:04 -07:00
Martin von Zweigbergk
662297acc3 tests: add test for delete/modify branch-conflict case (#32)
There was a TODO about adding a test case for a delete/modify conflict
in a branch target that got resolved by abandoning a commit. The
resolution is to delete the branch. That case couldn't happend with
our old evolution-based mechanism for tracking rewrites (because we
couldn't un-prune a commit then).
2022-03-27 21:11:55 -07:00
Martin von Zweigbergk
2ac62203d5 tests: add test for invalid config (#55) 2022-03-27 21:11:55 -07:00
Martin von Zweigbergk
d68eee296e tests: check that stderr is empty after successful commands
Successful commands should probably not write to stderr. If we later
add commands that e.g. print warnings to stderr, we'll want to cover
that explicitly in test.
2022-03-27 21:11:55 -07:00
Martin von Zweigbergk
12bce70bed cli: display how many commits were rebased when merging operations (#111)
This involved copying `UnresolvedHeadRepo::resolve()` into the CLI
crate (and modifying it a bit to print number of rebased commit),
which is unfortunate.
2022-03-26 22:31:49 -07:00
Martin von Zweigbergk
f7abeed2a6 transaction: move rebasing of descendants out of merge_operation() (#111)
I want to do the rebasing a bit later, so the CLI can do it and print
how many commits got rebased.
2022-03-26 22:31:49 -07:00
Martin von Zweigbergk
a0f05a60e4 repo: inline merge_op_heads() (#111)
The function is now pretty simple, and there's only one caller, so
let's inline it. It probably makes sense to move the code out of
`repo.rs` at some point.
2022-03-26 22:31:49 -07:00