Skip to content

cli: fix: add --summary --stat and --patch/-p to display changes made by the command - #9934

Open
jlndr wants to merge 4 commits into
jj-vcs:mainfrom
jlndr:fix-feedback
Open

cli: fix: add --summary --stat and --patch/-p to display changes made by the command#9934
jlndr wants to merge 4 commits into
jj-vcs:mainfrom
jlndr:fix-feedback

Conversation

@jlndr

@jlndr jlndr commented Aug 7, 2026

Copy link
Copy Markdown

Enable feedback for jj fix, issue #9715

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added/updated tests to cover my changes
  • I fully understand the code that I am submitting (what it does,
    how it works, how it's organized), including any code drafted by an LLM.
  • For any prose generated by an LLM, I have proof-read and copy-edited with
    an eye towards deleting anything that is irrelevant, clarifying anything
    that is confusing, and adding details that are relevant. This includes,
    for example, commit descriptions, PR descriptions, and code comments.

jj fix -p with native formater:
jj fix -p

@jlndr
jlndr requested a review from a team as a code owner August 7, 2026 10:44
@jlndr
jlndr force-pushed the fix-feedback branch 2 times, most recently from e805f17 to e5d734f Compare August 7, 2026 12:14
@josephlou5

Copy link
Copy Markdown
Contributor

Per https://docs.jj-vcs.dev/latest/contributing/#commit-guidelines, each individual commit should be standalone and self-contained.

  • I would probably suggest for each commit to change CHANGELOG.md, with subsequent commits updating the entry if that's what you want (new entries are also fine).
  • Please also link the issue from each commit. The last commit can say "Fixes #..." to autoclose the issue if you want.
  • In the description of 2e703f4, MARKDOWN=true seems to be a Google-ism :) AFAIK it has no effect on Git repos, so can probably be removed.

@josephlou5

Copy link
Copy Markdown
Contributor

And for the topic(s), I think you can use fix: instead of cli:, since these commits are for the jj fix command. Or you can use cli: fix:, or any variation of that. I think it's nice to mention fix in the topic; it also saves you a few characters in the rest of the subject.

Comment thread cli/src/commands/fix.rs Outdated
Comment thread cli/src/commands/fix.rs
@jlndr
jlndr force-pushed the fix-feedback branch 3 times, most recently from b7a89a3 to 22e85b8 Compare August 8, 2026 15:42
@jlndr

jlndr commented Aug 8, 2026

Copy link
Copy Markdown
Author
  • I would probably suggest for each commit to change CHANGELOG.md, with subsequent commits updating the entry if that's what you want (new entries are also fine).

  • Please also link the issue from each commit. The last commit can say "Fixes #..." to autoclose the issue if you want.

  • In the description of 2e703f4, MARKDOWN=true seems to be a Google-ism :) AFAIK it has no effect on Git repos, so can probably be removed.

Moved the changelog updates into each commit, mentioned the issues and removed the markdown tag :) PTAL if I missed something

@jlndr jlndr changed the title cli: add --summary --stat and --patch/-p to fix to display changes made by the command cli: fix: add --summary --stat and --patch/-p to display changes made by the command Aug 8, 2026
@josephlou5

Copy link
Copy Markdown
Contributor

LGTM, but needs maintainer approval.

@jlndr

jlndr commented Aug 9, 2026

Copy link
Copy Markdown
Author

Appreciate the review! @josephlou5

@PhilipMetzger

Copy link
Copy Markdown
Contributor

just my two cents but shouldn't a output template fix all of these issues at once? Otherwise people will expect similar flags for jj run which can be good or bad but it could prevent a command unification later.

@josephlou5

Copy link
Copy Markdown
Contributor

just my two cents but shouldn't a output template fix all of these issues at once?

Not necessarily. I assume a template for jj fix would be TreeDiffEntry types (so same as jj diff), but then you wouldn't be able to print the stat bars (see #8738). --summary and --patch can be done entirely inside templates though. (But indeed a template would probably be a more "general" solution to this.)

@jlndr

jlndr commented Aug 10, 2026

Copy link
Copy Markdown
Author

Maybe I'm misunderstanding the concern but other commands have both capabilities AFAIK, e.g. log, diff and show, and the flags are a convenient complement to templating, so this brings fix in line with those.

I don't know if the same flags would be suitable for jj run, but instinctively if a command modifies a commit, a diff output format would be nice as feedback.

No strong opinions really, keeping just a template for now would also be fine with me

Comment thread docs/paid_contributors.md Outdated
* honglooker
* hooper
* incognito124
* jlinder

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be your GitHub account name, not your Google account.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ops yes of course - fixed

jlndr added 4 commits August 11, 2026 07:11
…mmit.

This adds `--summary` flag to `fix` command to show modified files per commit.
Note: we can't use the shortflag `-s` since it's already used by
`--source`. Issue jj-vcs#9715.

Example:
```
$ jj fix --summary -s vyxlzqxr::mopmyzxr
Fixed 3 commits of 3 checked.
mopmyzxr 3e0efd9b another comment to fix
M cli/tests/test_fix_command.rs
vyxlzqxr 4f66ccc2 test fix
M cli/src/commands/fix.rs
Working copy  (@) now at: vnozyxkm 34ecd51c (empty) (no description set)
Parent commit (@-)      : mopmyzxr 3e0efd9b another comment to fix
Added 0 files, modified 2 files, removed 0 files
```
… commit.

This adds `--stat` flag to `fix` command to show histogram of changes per commit. Issue jj-vcs#9715

Example:
```
$ jj fix --stat -s vyxlzqxr::mopmyzxr
Fixed 3 commits of 3 checked.
mopmyzxr 8315f1d4 another comment to fix
cli/tests/test_fix_command.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
vyxlzqxr 8b92fb74 test fix
cli/src/commands/fix.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Working copy  (@) now at: vnozyxkm f4970928 (empty) (no description set)
Parent commit (@-)      : mopmyzxr 8315f1d4 another comment to fix
Added 0 files, modified 2 files, removed 0 files
```
… commit.

This adds `-p`/`--patch` flag to `fix` command to show patch of changes per commit. Fixes jj-vcs#9715.

Example:
```
$ jj --config ui.diff.format=git fix -p -s vyxlzqxr::mopmyzxr
Fixed 3 commits of 3 checked.
mopmyzxr bc7260bf another comment to fix
diff --git a/cli/tests/test_fix_command.rs b/cli/tests/test_fix_command.rs
index 5636280845..74e5fe7feb 100644
--- a/cli/tests/test_fix_command.rs
+++ b/cli/tests/test_fix_command.rs
@@ -12,8 +12,8 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.

-fn unformatted_test_fn_2(   name: &str  , count: u32  ) -> String {
-    let s  =  format!( "{name}_{count}" );
+fn unformatted_test_fn_2(name: &str, count: u32) -> String {
+    let s = format!("{name}_{count}");
     s
 }

vyxlzqxr 50f927a4 test fix
diff --git a/cli/src/commands/fix.rs b/cli/src/commands/fix.rs
index 4f6ba84f1e..a1dd971a8c 100644
--- a/cli/src/commands/fix.rs
+++ b/cli/src/commands/fix.rs
@@ -159,9 +159,9 @@
 /// ```
 /// The revisions are now all correctly formatted according to the
 /// configuration.
-fn unformatted_test_fn_1(  a : usize , b: &str ) ->   bool {
-    let x=1+2;
-    x==3
+fn unformatted_test_fn_1(a: usize, b: &str) -> bool {
+    let x = 1 + 2;
+    x == 3
 }

 #[derive(clap::Args, Clone, Debug)]
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants