Commit Graph

1390 Commits

Author SHA1 Message Date
Martin von Zweigbergk
7a99257040 cli: add a --dry-run for jj git push 2022-07-04 22:50:40 -07:00
Martin von Zweigbergk
c10c510e01 cli: make jj git push print what it's going to push
It's convenient to push all changed branches every time with `jj git
push`, but sometimes I want to know which branches were actually
pushed. This make the command print what it's going to do.

I'll add a `--dry-run` mode and tests next.
2022-07-04 22:50:40 -07:00
Martin von Zweigbergk
3aaeca9e1c tests: add test for successful push
I think I had not added tests for successful push before because I
thought there was some issue with testing it with libgit2. There *is*
an issue, which is that libgit2 requires the remote to be bare when
it's on local disk, but we can very easily make the git repo bare in
this test.

I also updated the error handling in the `git` module to not let
follow-on errors hide the real error and to not fail if two branches
moved to the same commit.
2022-07-04 22:50:40 -07:00
dependabot[bot]
d767bab2c5 cargo: bump serde from 1.0.137 to 1.0.138
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.137 to 1.0.138.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.137...v1.0.138)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-04 17:24:10 -07:00
Martin von Zweigbergk
d3f2b4c9cd cli: fix mention of jj git pull to be jj git fetch
This addresses the issue from the title of #412.
2022-07-02 11:06:45 +08:00
Martin von Zweigbergk
88864871b7 cli: if clone fails, delete destination directory
Closes #400.
2022-07-01 11:48:56 +08:00
Martin von Zweigbergk
485dcb2779 cli: on clone, split fetch transaction from checkout transaction
Fetching is typically much expensive than checking out, so if fetching
completes but checking out fails (due to some bug, perhaps), it seems
better to commit the fetch transaction. That way, the user can inspect
the repo and try checking out again.
2022-07-01 11:48:56 +08:00
Martin von Zweigbergk
a2b4bd239f cli: check that clone target is an empty dir if it exists
We used to check only if the destination already had a `.jj/`
directory. This patch changes that to check that the destination is an
empty directory.

Closes #399.
2022-07-01 09:03:24 +08:00
Martin von Zweigbergk
5d871810a1 tests: add test for jj git clone
We didn't seem to have any. I included a test for #399.

The tests also showed how the debug formatting (`{:?}`) results in
escaped (e.g.) backslashes on Windows, which is not what we want, so I
also fixed that.
2022-07-01 09:03:24 +08:00
Martin von Zweigbergk
418ab22be0 cli: add config for using only new UX for open commits
By adding `ui.open-commits=false` in your config, you can now make `jj
checkout` always create a new working-copy commit on top of the
specified commit. If the config is set, open commits will also appear
in the same color as closed commits in `jj log` etc. This will let
some of us experiment with the new UX before we decide if it's a good
idea or not. I left `jj close` in place because it's useful for
setting a description and creating a new commit in one step.

I didn't mention the new config in the release notes because I hope we
can reach a decision and remove the config before the next release.
2022-07-01 08:58:08 +08:00
Martin von Zweigbergk
42b2937d5e cli: add jj edit for editing a commit in the wokring copy 2022-07-01 08:58:08 +08:00
Martin von Zweigbergk
6952b4f91e rewrite: create new checkout on top iff commit abandoned
When rebasing commits after rewrites, we also update all workspaces'
checkouts. If the new commit is closed, we create a new commit on
top. Since we're hoping to remove the open/closed concept, we need a
new condition. I considered creating a new commit on top if the change
ID was different from before the rewrite. However, that would make at
least `jj split` more complicated because it makes the first commit
keep the change ID but it wants the second commit to be checked
out. This patch instead creates the new commit on top only when the
original commit was abandoned.
2022-07-01 08:58:08 +08:00
Martin von Zweigbergk
3e3299fbab cli: make jj close manually check out the new commit
When a commit gets rewritten, we update any workspaces pointing to the
old commit to check out the rewritten commit. If the rewritten commit
is closed, we create a new working-copy commit on top of it. Since
we're thinking about removing the open/closed concept, we need to make
`jj close` manually create the new working-copy commit.
2022-07-01 08:58:08 +08:00
Martin von Zweigbergk
b0912b3199 repo: add a function for getting workspaces by checkout 2022-07-01 08:58:08 +08:00
Martin von Zweigbergk
0e812220af rewrite: always use MutableRepo::edit() when updating checkouts
I think it's conceptually simpler to create a new commit and set that
commit to be the checkout in each workspace than to check out the
commit in one workspace and edit in the others.
2022-07-01 08:58:08 +08:00
Martin von Zweigbergk
bd1a8bd930 repo: split out an edit() function from MutableRepo::check_out() 2022-07-01 08:58:08 +08:00
Martin von Zweigbergk
9a3c6928cc repo: extract a function for abandoning previous checkout
This is a little refactoring to prepare for removing the `open` flag
off of commits.
2022-07-01 08:58:08 +08:00
Martin von Zweigbergk
54285a9c56 tests: add test of jj checkout
I'm about to change how `jj checkout` works w.r.t. open/closed commits
(and in particular by moving some logic from the library crate to the
CLI), so let's make sure we have some test coverage.
2022-07-01 08:58:08 +08:00
Martin von Zweigbergk
9c55d98842 cli: rename jj edit to jj touchup 2022-07-01 08:58:08 +08:00
Martin von Zweigbergk
fc4b109e5b cli: allow pushing open commits
Since we're thinking of removing the concept of open and closed
commits, we can't use that open/closed distinction to decide to not
push some commits.
2022-07-01 08:58:08 +08:00
Martin von Zweigbergk
8667e374b8 rewrite: pass a single new commit into update_checkouts()
`DescendantRebaser::update_checkouts()` only cares about the first
element in `new_commit_ids`, so let's just pass in a single commit ID
instead.
2022-07-01 08:58:08 +08:00
dependabot[bot]
73729e4517 cargo: bump serde_json from 1.0.81 to 1.0.82
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.81 to 1.0.82.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.81...v1.0.82)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-01 02:19:56 +08:00
dependabot[bot]
79c0b2696c cargo: bump clap from 3.2.7 to 3.2.8
Bumps [clap](https://github.com/clap-rs/clap) from 3.2.7 to 3.2.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.2.7...v3.2.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-07-01 02:19:28 +08:00
Martin von Zweigbergk
c2a7152423 docs: explain that we don't support Git hooks 2022-07-01 00:38:56 +08:00
dependabot[bot]
40293b5f9a github: bump github/codeql-action from 2.1.14 to 2.1.15
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.14 to 2.1.15.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](41a4ada31b...3f62b754e2)

---
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-06-30 12:53:45 +08:00
Richard Smith
2d01ebb57c Fix help formatting and missing word. 2022-06-29 14:52:12 -07:00
Martin von Zweigbergk
0fe203ce8f cleanup: fix an unused import on Windows
`OperationId` is only used in `test_snapshot_special_file()`, which
doesn't run (or even  build) on Windows.
2022-06-29 07:21:24 +08:00
dependabot[bot]
d5ae66a5e0 cargo: bump clap_complete from 3.2.2 to 3.2.3
Bumps [clap_complete](https://github.com/clap-rs/clap) from 3.2.2 to 3.2.3.
- [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-v3.2.2...clap_complete-v3.2.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-29 06:51:07 +08:00
dependabot[bot]
937ab16471 cargo: bump clap_mangen from 0.1.9 to 0.1.10
Bumps [clap_mangen](https://github.com/clap-rs/clap) from 0.1.9 to 0.1.10.
- [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_mangen-v0.1.9...clap_mangen-v0.1.10)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-29 06:30:28 +08:00
dependabot[bot]
dbfaef5eac cargo: bump clap from 3.2.6 to 3.2.7
Bumps [clap](https://github.com/clap-rs/clap) from 3.2.6 to 3.2.7.
- [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.2.6...v3.2.7)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-29 06:29:22 +08:00
dependabot[bot]
54de880845 github: bump ossf/scorecard-action from 1.1.1 to 1.1.2
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 1.1.1 to 1.1.2.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](3e15ea8318...ce330fde6b)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-29 06:28:31 +08:00
Tal Pressman
0028c0e295 Update installation instructions
Update installation instructions to only install `jj` (excluding test fakes).
2022-06-28 06:38:16 +08:00
dependabot[bot]
784692007f github: bump github/codeql-action from 2.1.13 to 2.1.14
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.13 to 2.1.14.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](d00e8c09a3...41a4ada31b)

---
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-06-27 06:25:48 +08:00
dependabot[bot]
865b4ff0a4 cargo: bump clap from 3.2.5 to 3.2.6
Bumps [clap](https://github.com/clap-rs/clap) from 3.2.5 to 3.2.6.
- [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.2.5...v3.2.6)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-23 05:40:16 +08:00
dependabot[bot]
8036177f94 cargo: bump clap_complete from 3.1.4 to 3.2.2
Bumps [clap_complete](https://github.com/clap-rs/clap) from 3.1.4 to 3.2.2.
- [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-v3.1.4...clap_complete-v3.2.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-22 07:31:22 +07:00
dependabot[bot]
0419f2c561 cargo: bump clap_mangen from 0.1.7 to 0.1.9
Bumps [clap_mangen](https://github.com/clap-rs/clap) from 0.1.7 to 0.1.9.
- [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_mangen-v0.1.7...clap_mangen-v0.1.9)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-22 07:30:26 +07:00
Martin von Zweigbergk
d10f61dd88 cargo: bump clap from v3.1.18 to v3.2.5 2022-06-22 06:39:25 +07:00
dependabot[bot]
42f24521ad github: bump github/codeql-action from 2.1.12 to 2.1.13
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.12 to 2.1.13.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](27ea8f8fe5...d00e8c09a3)

---
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-06-22 04:11:32 +07:00
Martin von Zweigbergk
2c21ed40d8 working_copy: don't crash if file becomes directory while snapshotting
If a file gets replaced by a directory right after list files in a
directory but before we stat the file, we currently crash. Let's
instead treat it as a missing file, using the mechanism introduced for
#258.
2022-06-21 05:38:28 +07:00
dependabot[bot]
0c3334e4e4 cargo: bump insta from 1.14.1 to 1.15.0
Bumps [insta](https://github.com/mitsuhiko/insta) from 1.14.1 to 1.15.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.14.1...1.15.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-06-21 04:10:57 +07:00
Martin von Zweigbergk
29a71c619a working_copy: ignore special files
This patch makes us treat special files (e.g. Unix sockets) as absent
when snapshotting the working copy. We can consider later reporting
such files back to the caller (possibly via callback) so it can inform
the user about them.

Closes #258
2022-06-20 09:26:29 +07:00
Martin von Zweigbergk
a42b24c014 working_copy: on checkout, record file state's type and size
This patch is essentially f6a516ff6d taken further, to also apply to
when we write a symlink or a conflict. As with regular files, these
races seem very unlikely to happen, but I found these cases while
working on #258, so let's fix. Fixing it also means that we don't need
to handle these transition cases in the next patch (when
`file_states()` can indicate that the file is e.g. a socket).
2022-06-20 09:26:29 +07:00
dependabot[bot]
242c506a9c cargo: bump openssl-src from 111.18.0+1.1.1n to 111.20.0+1.1.1o
Bumps [openssl-src](https://github.com/alexcrichton/openssl-src-rs) from 111.18.0+1.1.1n to 111.20.0+1.1.1o.
- [Release notes](https://github.com/alexcrichton/openssl-src-rs/releases)
- [Commits](https://github.com/alexcrichton/openssl-src-rs/commits)

---
updated-dependencies:
- dependency-name: openssl-src
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-18 02:11:53 +07:00
Martin von Zweigbergk
051c01491c cli: teach obslog an option to show diff
This patch adds `jj obslog -p` for including the diff compared to the
predecessor (the first predecessor if there are several). If the
predecessor's parents are different, then we create a temporary tree
by rebasing the predecessor to have the same parents and we use the
result as base for the diff. That way, we avoid polluting the diff
with the changes caused by the rebase. (I don't think we currently
have any commands that can change both parents and content, so the
diff should always be empty for rewrites caused by a rebase.)

Working on this also reminded me that it'll be really nice when we
replace `jj obslog` by something based on the operation log - I really
miss seeing information about the operation in the output (like `hg
obslog` gets from its obsmarkers).
2022-06-14 04:39:49 -07:00
dependabot[bot]
02346de60e cargo: bump clap_mangen from 0.1.6 to 0.1.7
Bumps [clap_mangen](https://github.com/clap-rs/clap) from 0.1.6 to 0.1.7.
- [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_mangen-v0.1.6...clap_mangen-v0.1.7)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-13 10:06:52 -07:00
dependabot[bot]
2716f17d71 cargo: bump uuid from 1.1.1 to 1.1.2
Bumps [uuid](https://github.com/uuid-rs/uuid) from 1.1.1 to 1.1.2.
- [Release notes](https://github.com/uuid-rs/uuid/releases)
- [Commits](https://github.com/uuid-rs/uuid/compare/1.1.1...1.1.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-13 10:06:25 -07:00
Martin von Zweigbergk
a4a148104c cli: don't say "Creating branch push-*" if it already exists
I was a bit surprised to see the message when I used `jj git push
--change @-` on a commit that already had a branch because I had
pushed it earlier.

The fix means that we instead print the message even if we later
abandon the transaction (so the branch-creation is not persisted)
because the commit is open, for example. That's already what happens
if the commit is missing a description, and since we're planning to
remove the open/closed concept, I don't think this patch makes it much
worse. We probably should improve it later by printing the message
only once the push has succeeded.
2022-06-10 09:30:55 -07:00
Martin von Zweigbergk
39fc56dafb github: include reminder about docs in PR template 2022-06-09 22:43:53 -07:00
Martin von Zweigbergk
a15192c05b docs: update to use new jj branch syntax 2022-06-09 22:24:46 -07:00
Martin von Zweigbergk
e8e03880cf matchers: add IntersectionMatcher
I plan to use this matcher for some future `jj add` command (for
#323). The idea is that we'll do a path-restricted walk of the working
copy based on the intersection of the sparse patterns and any patterns
specified by the user. However, I think it will be useful before that,
for @arxanas's fsmonitor feature (#362).
2022-06-09 21:27:51 -07:00