Commit graph

2363 commits

Author SHA1 Message Date
dependabot[bot]
fb6181f212 cargo: bump assert_cmd from 2.0.7 to 2.0.8
Bumps [assert_cmd](https://github.com/assert-rs/assert_cmd) from 2.0.7 to 2.0.8.
- [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.7...v2.0.8)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-10 08:25:05 -08:00
Yuya Nishihara
cb0b9e590a cli: do not search ancestor paths specified by -R/--repository
If a workspace path is explicitly specified, it must point to the exact
workspace directory. This is the same behavior as 'hg -R'. OTOH, 'git -C'
is the option to chdir, so it makes sense to search .git from that directory.

This also fixes 'jj -R ../..' which would previously look up '../..', '..',
'.', ...
2023-01-10 23:31:26 +09:00
Yuya Nishihara
40a9f75441 workspace: do not look up ancestor paths by Workspace::load()
I don't think Workspace::load() should be permissive in that regard.
WorkspaceLoader could provide such function, but I feel it's more like
CLI business. CLI can also look for parent '.git' directory to suggest
'jj init --git-repo=..' if needed.
2023-01-10 23:31:26 +09:00
Ilya Grigoriev
65de7cb0eb jj log: Change conflicted branches from br? to br??
The divergent changes are marked with ?? (I found a single ? a bit easy to
overlook), and this should be consistent.

Ideally, the conflicted branches would also be red, but this takes a bit
larger changes to `templater.rs`: another `Property` as well as changes to
https://github.com/martinvonz/jj/blob/7f9a0a28/src/template_parser.rs#L385-L395
2023-01-09 22:44:45 -08:00
Ilya Grigoriev
8093bc0614 jj log: Replace divergent label with ?? and red color
This follows up on a [discussion] in a previous PR #941.

[discussion]: https://github.com/martinvonz/jj/pull/941#issuecomment-1363551162

Screenshot: https://user-images.githubusercontent.com/4123047/209286340-bb83df2d-4020-4608-9755-d965477799c3.png
2023-01-09 22:44:45 -08:00
Ilya Grigoriev
5f2a99ac8a Test commit template with divergence 2023-01-09 22:44:45 -08:00
Ilya Grigoriev
a43c47a28c Move a test from test_log_command to test_commit_template 2023-01-09 22:44:45 -08:00
Yuya Nishihara
cef5e8795c cli: use .display() to stringify RepoDoesNotExist error 2023-01-10 11:51:29 +09:00
Yuya Nishihara
d798213cc8 cli: do not look up workspace path more than once, reuse WorkspaceLoader 2023-01-10 11:51:29 +09:00
Yuya Nishihara
c3903cb914 cli: wrap clap::Error within Arc to make CommandError cloneable
This allows us to load workspace by using &Result<T, CommandError>. Even
though load_workspace() wouldn't be called more than once, consuming self
there is annoying.
2023-01-10 11:51:29 +09:00
dependabot[bot]
1df1603b0b cargo: bump regex from 1.7.0 to 1.7.1
Bumps [regex](https://github.com/rust-lang/regex) from 1.7.0 to 1.7.1.
- [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.7.0...1.7.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-09 08:54:02 -08:00
dependabot[bot]
b85e4e136f cargo: bump insta from 1.24.1 to 1.26.0
Bumps [insta](https://github.com/mitsuhiko/insta) from 1.24.1 to 1.26.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.24.1...1.26.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-09 08:53:09 -08:00
Martin von Zweigbergk
9257cc34e5 formatter: don't allow rules to match labels out of order
I don't see a good reason to let e.g. "added diff" to match added text
inside a diff when we already allow "diff added" for that. Allowing
both means that we have to decide which should take precedence. With
the recent change to add labels for methods, we no longer depend on it
for the "timestamp author" case ("author timestamp" now
matches). Thanks to @yuja for noticing that dependency.
2023-01-08 23:01:53 -08:00
Martin von Zweigbergk
f46030e549 log: remove redundant "timestamp" label from default template
We now already have the "timestamp" label from the auto-labeling of
method calls.

Without the use of the "email" label in the previous commit, we would
now emit an unnecessary color code when the "author" label is added
but before the "timestamp" is added. So that patch wasn't just about
simplifiying the config :)
2023-01-08 23:01:53 -08:00
Martin von Zweigbergk
0a29ef841f colors: simplify now that we have auto-labeling of methods 2023-01-08 23:01:53 -08:00
Martin von Zweigbergk
ff94725361 templater: auto-label template method calls 2023-01-08 23:01:53 -08:00
Martin von Zweigbergk
0b9ab871b2 templater: create a type for property+labels
I'm going to make `parse_method_chain` also return a list of labels to
add, so we can make e.g. `author.timestamp()` automatically get
labeled with both "author" and "timestamp".
2023-01-08 23:01:53 -08:00
Martin von Zweigbergk
4953467e44 templater: expect a list of labels instead of splitting on whitespace
It's clearly the parser's job to split labels in a string provided by
the user. This patch moves the splitting we were doing in
`LabelTemplate` and `DynamicLabelTemplate` to the parser. In the
former case, the string isn't even provided by the user and it doesn't
contain whitespace, we can drop the splitting altogether.
2023-01-08 23:01:53 -08:00
Martin von Zweigbergk
2506cdee28 log: add test of colored output
I'm about to make some changes to the templater, so let's have a test
least a simple test of the current colored output.
2023-01-08 12:32:31 -08:00
Martin von Zweigbergk
1b4992e11c tests: create new file for tests of commit template
An important part of the `jj log` output is the commit template. I
suspect we'll have many more tests for that, so let's move it to a
separate file. The main `test_log_command.rs` can focus on which
commits to display.
2023-01-08 12:32:31 -08:00
Ilya Grigoriev
a5d77a27e8 cargo +nightly clippy --fix --workspace with today's nightly 2023-01-07 15:29:19 -08:00
Ilya Grigoriev
a022beedd7 jj status: show same output as jj resolve --list for conflicts
Screnshot: https://user-images.githubusercontent.com/4123047/211169647-773b2e08-dade-4aa4-9a60-f3a3e7c08084.png
2023-01-07 15:29:19 -08:00
Ilya Grigoriev
fc9795e902 jj resolve --list: make output colorful
The description is usually in yellow, which looks nice and neutral. If the
conflict has more than 2 sides or has special files, that's marked in red.
2023-01-07 15:29:19 -08:00
Ilya Grigoriev
89de9aeae1 jj resolve --list: Replace separator with \t
The `:` was a bit noisy. With upcoming color support, it seems unnecessary.

This should also be a little better for any tools that want to parse the
output.

Finally, `insta` also seems to want to rewrite test snapshots to be shorter.
They seem equivalent.
2023-01-07 15:29:19 -08:00
Ilya Grigoriev
e32342a6c4 jj op log: Show durations with relative timestamps
Before, the humanized versions of start and end times often were identical.
2023-01-07 12:08:00 -08:00
Ilya Grigoriev
a48b4855be Have jj op log obey ui.relative-timestamps option 2023-01-07 12:08:00 -08:00
Ilya Grigoriev
c5563115a4 Consolidate and extract timestamp display functions in one file
The functionality for absolute timestamps was duplicated. A
function for displaying relative timestamps will be needed in
the next commit.
2023-01-07 12:08:00 -08:00
Ilya Grigoriev
d5430a9258 resolve --list: account for deletions of special files
This will match `jj`'s behavior of being unable to resolve such conflicts or to
show readable diffs for them, in the pre-#978 state.


This is a fixup of 621293d7c6.
2023-01-06 23:36:14 -08:00
Martin von Zweigbergk
4aeb4f6e2a tests: drop no-longer-needed filtering of change ID
Our change IDs are now predictable in tests.
2023-01-06 23:03:58 -08:00
Yuya Nishihara
ea96ea3ffe cli: load configs from .jj/repo/config.toml
Since per-repo config may contain CLI settings, it must be visible to CLI.
Therefore, UserSettings::with_repo() -> RepoSettings isn't used, and its
implementation is nullified by this commit.

#616
2023-01-07 11:33:12 +09:00
Yuya Nishihara
810789a830 workspace: extract WorkspaceLoader to resolve paths without loading 2023-01-07 11:33:12 +09:00
Yuya Nishihara
6addfb0198 cli: migrate --config-toml processing, make UserSettings immutable
It's unclear whether parse_args() or its caller should update LayeredConfigs.
--config-toml is processed by callee to apply --color early. -R/--repository
will be processed by caller since it will instantiate WorkspaceLoader.
Maybe --config-toml can be removed from EarlyArgs, and handle_early_args()
just updates ui state based on --color argument?
2023-01-07 11:33:12 +09:00
Yuya Nishihara
39d5ce97ad cli: initialize ui with merged config containing defaults and envs
Since CliRunner knows both defaults and envs, it makes sense to feed them
to initialize ui.
2023-01-07 11:33:12 +09:00
Yuya Nishihara
3557622b09 cli: introduce struct that stores unmerged configs
Thinking of config precedence, we'll probably need to store "base" (default +
env_base + user) config and "override" (env_overrides + --config-toml) config
separately to support repo config. Suppose env_overrides() is a temporary
value, it's better to override any file-derived values with $JJ_ env.
2023-01-07 11:33:12 +09:00
Yuya Nishihara
47e2e4d220 cli: extract function that reads user config without merging
The next commit will add a struct that keeps umerged configs, which will be
used to insert repo config between user and override configs.
2023-01-07 11:33:12 +09:00
Yuya Nishihara
b3c792f7bf cli: resolve command alias without using UserSettings, use config::Config
For the same reason as the previous commit. -R/--repository can't be parsed
until the real command name gets available.
2023-01-07 11:33:12 +09:00
Yuya Nishihara
d0d92a0e06 cli: initialize Ui without using UserSettings, use config::Config
UserSettings will be instantiated after both user and repo configs are
loaded. We might want to add a wrapper for CLI settings, but I have no idea
how that should be structured. Let's use bare config::Config until then.
2023-01-07 11:33:12 +09:00
Yuya Nishihara
3c99852ebd tests: add basic config precedence test 2023-01-07 11:33:12 +09:00
dependabot[bot]
0bc52d4386 cargo: bump glob from 0.3.0 to 0.3.1
Bumps [glob](https://github.com/rust-lang/glob) from 0.3.0 to 0.3.1.
- [Release notes](https://github.com/rust-lang/glob/releases)
- [Commits](https://github.com/rust-lang/glob/compare/0.3.0...0.3.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-06 07:53:02 -08:00
dependabot[bot]
f2cba66029 github: bump actions/upload-artifact from 3.1.1 to 3.1.2
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3.1.1 to 3.1.2.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](83fd05a356...0b7f8abb15)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-06 07:52:03 -08:00
Ilya Grigoriev
621293d7c6 jj resolve --list: Add descriptions of conflict complexity
The descriptions focus on adds, not the deletions. The deletions are used
to compute the number of deleted files that must be sides of the conflict.
2023-01-05 10:59:14 -08:00
Ilya Grigoriev
1f39ffce01 Rename print_conflicted_{files=>paths} 2023-01-05 10:59:14 -08:00
dependabot[bot]
6a6724fd87 github: bump actions/checkout from 3.2.0 to 3.3.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.2.0 to 3.3.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](755da8c3cf...ac59398561)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-05 15:33:10 +00:00
David Barnett
6da1ecfba0 Add pkg-config to required Linux dependencies
Without it, cargo started erroring out for me after #970 saying it
couldn't find openssl without pkg-config being installed.
2023-01-05 08:01:34 -06:00
Ilya Grigoriev
5ecac4fc44 jj resolve: List remaining conflicts (if any) on success
This can be prevented by the new `--quiet` option.
2023-01-04 21:48:33 -08:00
Ilya Grigoriev
b8ba78b996 Extract resolve_list from cmd_resolve, tests, minor refactoring
This is all in preparation for follow-up commit, which will change
some of the new tests. The extracted function will be further expanded
later.
2023-01-04 21:48:33 -08:00
Yuya Nishihara
42a044b7c7 cli: move ui.settings() to CommandHelper, disown UserSettings from Ui
Still UserSettings is cloned to WorkspaceCommandHelper, but I think this is
slightly better since CommandHelper and WorkspaceCommandHelper are scoped
based on call stack. Perhaps, UserSettings can be shared by Arc or immutable
reference.
2023-01-05 14:33:10 +09:00
Yuya Nishihara
71102a7d4a cli: pass CommandHelper in to branch/rebase helper functions
This prepares for migration from ui.settings() to command.settings(). We could
instead add workspace_command.settings(), but I'm not sure which would be less
bad. Anyway, these functions live in command layer, so taking CommandHelper
makes sense.
2023-01-05 14:33:10 +09:00
Yuya Nishihara
d8d015613c cli: include pager command args in warning message
"No such file or directory" is useless without a command name.
2023-01-05 14:33:10 +09:00
Yuya Nishihara
cfac7468d8 cli: store resolved pager command in Ui
ui.settings() will be removed.
2023-01-05 14:33:10 +09:00