jj v0.41.0 is out

jj v0.41.0 is out

About jj is a Git-compatible version control system that is both simple and powerful. See the installation instructions to get started.

关于 jj 是一个既简单又强大的 Git 兼容版本控制系统。请参阅安装说明以开始使用。


Release highlights jj fix now supports formatting specific line ranges (allowing you to format only modified lines); see the configuration manual and notes below for more. The new global flag --no-integrate-operation will let you run a command without impacting the repo state or the working copy, which is useful when automated tools may create snapshots in the background.

发布亮点 jj fix 现在支持格式化特定的行范围(允许你仅格式化修改过的行);有关更多信息,请参阅配置手册和下方的说明。新的全局标志 --no-integrate-operation 允许你在不影响仓库状态或工作副本的情况下运行命令,这在自动化工具可能在后台创建快照时非常有用。


Breaking changes The --pattern flag for file search now defaults to regex: instead of glob:. jj git push --all/--tracked/-r REVSETS no longer fails when revisions to push are private or have conflicts. Bookmarks which aren’t eligible to push will be skipped. Branch/bookmark patterns passed to jj git clone are now saved to jj’s repo settings file instead of .git/config. Git fetch refspecs are set to the default value.

破坏性变更 文件搜索的 --pattern 标志现在默认使用 regex: 而不是 glob:。当要推送的修订版本是私有的或存在冲突时,jj git push --all/--tracked/-r REVSETS 不再报错。无法推送的书签将被跳过。传递给 jj git clone 的分支/书签模式现在保存到 jj 的仓库设置文件中,而不是 .git/config。Git 获取的 refspecs 被设置为默认值。


Deprecations In the templating language, the Operation type’s .tags() function has been deprecated in favor of .attributes().

弃用 在模板语言中,Operation 类型的 .tags() 函数已被弃用,取而代之的是 .attributes()


New features The --pattern flag for file search now accepts various pattern kinds through kind:pattern syntax. A new global flag --no-integrate-operation lets you run a command without impacting the repo state or the working copy. A new config option diff.git.show-path-prefix can be used to suppress the a/ and b/ path prefixes in the diff --git output. jj fix now supports line range-limited formatting via the fix.tools.<name>.line-range-arg and run-tool-if-zero-line-ranges configs. This allows running tools only on modified lines and fine-grained control over when the tool is run. If you have set the line-range-arg config, use --all-lines to match the previous behavior of formatting the entire file. A new replace(pattern, content, replacement) template function is added which supports replacement of content in templates, using a lambda to format replacement text. It supports all string patterns, including regexes with capture groups (e.g. replace(regex:'(\w+) (\w+)', "hello world", |c| c.get(1) ++ " " ++ c.get(2))). New ByteString template type for things like file content. jj gerrit upload now supports the new options --message (-m), --edit and --merged. You can now also pass multiple hashtags by repeating the --hashtag option. New remotes.<name>.fetch-bookmarks/fetch-tags options to configure default fetch targets. JJ_PAGER can now override the ui.pager config, matching JJ_EDITOR for callers that need a jj-specific environment override.

新功能 文件搜索的 --pattern 标志现在通过 kind:pattern 语法支持多种模式类型。新的全局标志 --no-integrate-operation 允许你在不影响仓库状态或工作副本的情况下运行命令。新的配置选项 diff.git.show-path-prefix 可用于在 diff --git 输出中隐藏 a/b/ 路径前缀。jj fix 现在通过 fix.tools.<name>.line-range-argrun-tool-if-zero-line-ranges 配置支持行范围限制格式化。这允许仅在修改过的行上运行工具,并对工具运行的时机进行细粒度控制。如果你设置了 line-range-arg 配置,可以使用 --all-lines 来恢复之前格式化整个文件的行为。新增了 replace(pattern, content, replacement) 模板函数,支持在模板中替换内容,并使用 lambda 表达式来格式化替换文本。它支持所有字符串模式,包括带有捕获组的正则表达式(例如 replace(regex:'(\w+) (\w+)', "hello world", |c| c.get(1) ++ " " ++ c.get(2)))。新增了用于文件内容等场景的 ByteString 模板类型。jj gerrit upload 现在支持新的选项 --message (-m)--edit--merged。你现在还可以通过重复 --hashtag 选项来传递多个标签。新增了 remotes.<name>.fetch-bookmarks/fetch-tags 选项以配置默认的获取目标。JJ_PAGER 现在可以覆盖 ui.pager 配置,这与 JJ_EDITOR 一致,适用于需要特定于 jj 的环境变量覆盖的调用者。


Fixed bugs Improving consistency with git handling of .gitignore, including / after entries and \r\r\n for MacOS files. jj status filters untracked paths by fileset #9287. Improved performance for snapshotting, visibly improving jj status speed for large repositories. Pre-existing Git submodule directories are no longer considered conflicts in checkouts. #8065. Fixed a panic in jj gerrit upload when run without -r and the inferred revision was immutable. #9398. jj status respects path filters in working copy summaries. jj git remote rename/remove now updates the trunk() alias. Commands would sometimes incorrectly diagnose a stale working copy and suggest running jj op integrate when it would have no effect. This should now be much less likely to happen in practice. #9314.

修复的 Bug 提高了与 Git 处理 .gitignore 的一致性,包括条目后的 / 和 MacOS 文件的 \r\r\njj status 现在通过文件集过滤未追踪路径 (#9287)。改进了快照性能,显著提升了大型仓库中 jj status 的速度。预先存在的 Git 子模块目录在检出时不再被视为冲突 (#8065)。修复了在未指定 -r 且推断出的修订版本不可变时运行 jj gerrit upload 导致的崩溃问题 (#9398)。jj status 在工作副本摘要中遵循路径过滤器。jj git remote rename/remove 现在会更新 trunk() 别名。命令有时会错误地诊断工作副本过时并建议运行 jj op integrate,即使这样做无效。在实践中,这种情况现在发生的可能性大大降低 (#9314)。