Commit Graph

1331 Commits

Author SHA1 Message Date
Martin von Zweigbergk
bcf94bd70e CommitBuilder: when rewriting commit, replace placeholder user/email
If a commit's author field has the placeholder user/email values
(i.e. "(no name configured)" and "(no email configured)"), and they
have now configured their email and username, they probably want us to
update the author field with the new information, so that's what this
patch does. Thanks to durin42@ for the suggestion on #322.
2022-06-06 17:31:01 -07:00
Martin von Zweigbergk
e9ed149c72 cli: remove unnecessary wrapping of Subcommand in Args struct
None of our subcommands have any arguments at the level of the
subcommand family (e.g. no `jj git --foo fetch`), so we don't need to
wrap the `Subcommand` attribute in an `Args` attribute.
2022-06-06 10:58:42 -07:00
Waleed Khan
84cb0858ad abandon: accept multiple revisions 2022-06-06 09:14:56 -07:00
Waleed Khan
de1c8f0f37 cli: make jj branch take subcommands, not flags
As per https://github.com/martinvonz/jj/issues/330.
2022-06-06 09:02:56 -07:00
dependabot[bot]
92b1ae8006 github: bump github/codeql-action from 2.1.11 to 2.1.12
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.11 to 2.1.12.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](a3a6c128d7...27ea8f8fe5)

---
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-02 08:59:28 -07:00
dependabot[bot]
1e87edb917 cargo: bump uuid from 1.1.0 to 1.1.1
Bumps [uuid](https://github.com/uuid-rs/uuid) from 1.1.0 to 1.1.1.
- [Release notes](https://github.com/uuid-rs/uuid/releases)
- [Commits](https://github.com/uuid-rs/uuid/compare/1.1.0...1.1.1)

---
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-01 09:07:34 -07:00
dependabot[bot]
2905eb390b github: bump ossf/scorecard-action from 1.1.0 to 1.1.1
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 1.1.0 to 1.1.1.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](5c8bc69dc8...3e15ea8318)

---
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-01 09:07:00 -07:00
dependabot[bot]
f6e95decb4 cargo: bump insta from 1.14.0 to 1.14.1
Bumps [insta](https://github.com/mitsuhiko/insta) from 1.14.0 to 1.14.1.
- [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.0...1.14.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-31 09:09:14 -07:00
Tal Pressman
9613e294f4 replace references to jj l with jj log 2022-06-01 00:00:43 +09:00
Martin von Zweigbergk
8ae9540f2c cli: make move/squash/unsquash keep empty working-copy commit
If the source commit becomes empty as a result of
`move/squash/unsquash`, we abandon it. However, perhaps we shouldn't
do that if the source commit is a working-copy commit because
working-copy commits are often work-in-progress commits.

The background for this change is that @arxanas had just started a new
change and had set a description on it, and then decided to make some
changes in the working copy that should be in the parent
commit. Running `jj squash` then abandoned the working-copy commit,
resuling in the description getting lost.
2022-05-30 07:52:24 -07:00
Martin von Zweigbergk
3b47b00ed0 tests: add e2e test for jj unsquash
We had tests for `jj move` and `jj squash`, but not for `jj
unsquash`. I'm about to add a `--keep` option, so let's add tests for
the current behavior first.
2022-05-30 07:52:24 -07:00
Martin von Zweigbergk
80f1a6f97d tests: extract a methods for log output in a few more tests 2022-05-30 07:52:24 -07:00
Tal Pressman
9766e80438 Log names of created branch for git push --change. 2022-05-27 21:07:34 -07:00
Waleed Khan
aedc23176f docs: add missing . in .jjconfig.toml 2022-05-26 18:59:31 -07:00
dependabot[bot]
9a2502f6b0 github: bump ossf/scorecard-action from 1.0.4 to 1.1.0
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 1.0.4 to 1.1.0.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](c1aec4ac82...5c8bc69dc8)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-26 08:36:59 -07:00
Yuya Nishihara
f5e4c77f8e cli: add .txt suffix to temporary commit description file
I've configured emacs to enable spell checking for text-mode. This helps
emacs open a description file in text-mode.
2022-05-26 23:48:34 +09:00
Martin von Zweigbergk
540f2eb583 errors: avoid using Debug formatting on error types
The regular `Display` format is (not surprisingly) more user-friendly,
as pointed out by @yuja.

I also switched to using format strings for these cases, and some
nearby strings for consistency.
2022-05-25 19:33:59 -07:00
dependabot[bot]
ee87215e1c cargo: bump uuid from 1.0.0 to 1.1.0
Bumps [uuid](https://github.com/uuid-rs/uuid) from 1.0.0 to 1.1.0.
- [Release notes](https://github.com/uuid-rs/uuid/releases)
- [Commits](https://github.com/uuid-rs/uuid/compare/1.0.0...1.1.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-25 12:25:15 -07:00
Martin von Zweigbergk
c9ab0a20d3 working_copy: stat path without traversing from root in one case
We can easily make the `DirEntry` available here, so we can call
`.metadata()` on that instead of on the `Path`. I think that avoids
walking the path. I'm sure this has no significant impact on
performance, but it's also almost as readable.
2022-05-25 11:51:18 -07:00
Martin von Zweigbergk
f6a516ff6d working_copy: record expected written size, not actual size, on checkout
When we have just written a file to disk on checkout, let's record the
size we expected instead of what we got from `fstat()`. This should
address a race where the file was modified between the time we wrote
it and the time we requested its stat. I just happened to notice this
while going through the code; it seems very unlikely to be noticed in
practice.
2022-05-25 11:51:18 -07:00
Martin von Zweigbergk
fa4b5aa2c7 working_copy: propagate most errors on checkout 2022-05-25 11:51:18 -07:00
Martin von Zweigbergk
9aa2009320 working_copy: improve error handling when getting file stats 2022-05-25 11:51:18 -07:00
Martin von Zweigbergk
9feb786a51 working_copy: extract function for getting mtime
We had a few lines of duplicated code for this, so I moved it into a
function and added better error handling.
2022-05-25 11:51:18 -07:00
Martin von Zweigbergk
23f9e6479f working_copy: stop suppressing a warning that doesn't happen
We mutate the `new_file_state` variable on line 513 regardless of
platform these days, so we don't need to suppress the warning on Unix.
2022-05-25 11:51:18 -07:00
Martin von Zweigbergk
ecb86118e5 working_copy: get file metadata using open file descriptor
When we have just written a file or conflict, we can get metadata for
it via the open file descriptor instead of using the path. That
removes the risk of a race where the file got removed or replaced by
another file type (at least on Unix).
2022-05-25 11:51:18 -07:00
Martin von Zweigbergk
e7aaf2f95f working_copy: pass Metadata into file_state()
This is a refactoring to prepare for getting the metadata from an
already open file when possible.
2022-05-25 11:51:18 -07:00
Martin von Zweigbergk
d451242746 working_copy: propagate backend errors on checkout 2022-05-25 11:51:18 -07:00
Martin von Zweigbergk
899325e94e working_copy: use #[from] to slightly simplify error handling 2022-05-25 11:51:18 -07:00
Martin von Zweigbergk
ac82ad892e github: fail CI on clippy warnings 2022-05-25 11:44:22 -07:00
Martin von Zweigbergk
9dbf32db3a settings: fix a clippy warning 2022-05-25 10:02:11 -07:00
Tal Pressman
9831b82a98 Add configuration option to override branch name prefix. 2022-05-26 00:41:52 +09:00
dependabot[bot]
044bc93aeb cargo: bump git2 from 0.14.2 to 0.14.4
Bumps [git2](https://github.com/rust-lang/git2-rs) from 0.14.2 to 0.14.4.
- [Release notes](https://github.com/rust-lang/git2-rs/releases)
- [Commits](https://github.com/rust-lang/git2-rs/compare/0.14.2...0.14.4)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-24 08:56:29 -07:00
Martin von Zweigbergk
45c9d297c2 drop: downgrade two assertions to error messages
These assertions were there to catch bugs, but when the bugs happen,
the assertions can obsure the underlying error (as @tp-woven found out
on #258). Let's just print errors instead.
2022-05-23 15:36:18 -07:00
dependabot[bot]
ca5a2391ab cargo: bump regex from 1.5.5 to 1.5.6
Bumps [regex](https://github.com/rust-lang/regex) from 1.5.5 to 1.5.6.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.5.5...1.5.6)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-23 09:10:52 -07:00
Martin von Zweigbergk
5c6f82ec7b tests: remove &UserSettings argument from TestRepo::init()
We don't even have any settings that affect the repo, so there's no
point in passing the settings. I think this was a leftover from before
we separated out the "workspace" concept; now we no longer create a
working-copy commit when we initialize a repo (we do that when we
attach the workspace).
2022-05-21 22:33:16 -07:00
Martin von Zweigbergk
4cf04f373e tests: move init_{repo,workspace} functions onto types
I tried to create a `TestRepo` and was surprised that I couldn't do
that by calling a function on it.
2022-05-21 22:33:16 -07:00
Martin von Zweigbergk
6c6e6cb423 checkout: don't abandon old commit if it has non-empty description
If the user entered a description, we shouldn't abandon it even if it
has no changes to the content.
2022-05-21 22:12:15 -07:00
Martin von Zweigbergk
eedc315821 cli: make jj new always check out the new commit
Before this change, `jj new` would check out the new commit only if it
was created on top of the current commit. I never liked that
special-casing, and after thinking more about how the open/closed
should work (see discussion #321), I think we want `jj new` to behave
similar to how `git/hg checkout` works, so it can effectively replace
the current `jj checkout` command for the use case of starting new
work on top of an existing commit.
2022-05-21 22:12:15 -07:00
Martin von Zweigbergk
689d9a836a cli: remove incorrect help for jj new
The help text said you can `jj abandon; jj co @-` to go to the parent
commit (it it's an open commit), but `jj abandon` already takes you to
the parent.
2022-05-21 22:12:15 -07:00
Martin von Zweigbergk
db27dd118f cleanup: remove some unused lifetimes 2022-05-21 10:41:45 -07:00
Martin von Zweigbergk
587d8521c5 cli: make op restore require an operation ID
It doesn't make much sense to default to restoring to the current
operation.
2022-05-20 16:19:33 -07:00
Martin von Zweigbergk
8f0c6a2fe9 cargo: use only "toml" feature from config crate
We don't need the `config` crate's support for JSON etc., so let's
just enable the TOML feature. (Trying to import all the JSON, RON,
dependencies etc. into Google's source control was a pain.)
2022-05-20 11:21:33 -07:00
dependabot[bot]
5d8f7dd0ce github: bump actions/upload-artifact from 3.0.0 to 3.1.0
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3.0.0 to 3.1.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](6673cd052c...3cea537223)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-20 09:08:59 -07:00
Martin von Zweigbergk
b46317596b cli: add update and up as aliases for checkout
Mercurial has these aliases, so it will be familiar for Mercurial
users. My only hesitation about adding these aliases is that we might
want the these names for something else in the future. You could
imagine `up` and `down` commands, for example. We still have a long
time before 1.0, so we have plenty of opportunity to make breaking
changes if we think of some other use for the names :)
2022-05-18 23:47:01 -07:00
Martin von Zweigbergk
0865b1ccff cli: show placeholder text for empty commit message
It can be confusing that some commits (typically the working copy)
don't have a description. Let's show a placeholder text in such cases.

I chose the format to match the "(no email configured)" message we
already have.
2022-05-18 09:16:04 -07:00
dependabot[bot]
3750d1097b cargo: bump test-case from 2.0.2 to 2.1.0
Bumps [test-case](https://github.com/frondeus/test-case) from 2.0.2 to 2.1.0.
- [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.2...v2.1.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-18 08:49:45 -07:00
Martin von Zweigbergk
f5f3091997 cli: make aliases (for commands and arguments) visible in help
This should help make e.g. `squash` discoverable for users who search
the help output for "amend". It should also help users discover the
builtin abbreviations like `st` (for `status`).
2022-05-17 11:02:03 -07:00
dependabot[bot]
cbe370fdd9 github: bump github/codeql-action from 2.1.10 to 2.1.11
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.10 to 2.1.11.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](2f58583a1b...a3a6c128d7)

---
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-05-17 09:07:56 -07:00
Martin von Zweigbergk
6c83eb6ae3 cli: teach log flag to show commits in reverse order
This adds a `--reversed` flag to `jj log` to show commits with later
commits further down. It works both with and without the graph.

Since the graph-drawing code is already independent of the
relationship between commits, it doesn't need any updating.
2022-05-15 05:17:54 -07:00
Martin von Zweigbergk
0747da0491 revset_graph_iterator: add a mode for generating reverse graph
The request to show the log output with more recent commits at the
bottom comes up once in a while (among Mercurial users, and now also
for jj from @arxanas). It's pretty easy to implement by adding an
adapter to the current `RevsetGraphIterator`. It works by first
collecting all nodes and edges into a vector and then yielding them in
reverse order and with reversed edges. That means it's no longer lazy,
but that seems fine since the feature is optional. Also, it's only the
subset of nodes that are in the selected revset that will be
collected.

Making the CLI use the new iterator adapter will come in a later
patch.
2022-05-15 05:17:54 -07:00