什么是Mercurial revsets的git等价物?

dav*_*idg 16 git mercurial mercurial-revsets

Mercurial有一种称为revsets的特定于域的语言,允许用户指定修订集.

例如,您可能希望列出尚未合并到分支中的补丁default:

hg log -r "all() - ancestors('default')"
Run Code Online (Sandbox Code Playgroud)

作为一个更复杂的示例,上面的链接给出了在标记1.3的修订版本和标记的修订版本之间列出变更集的示例,1.5其中提到"bug"并影响目录中的文件hgext:

hg log -r "1.3::1.5 and keyword(bug) and file('hgext/*')"
Run Code Online (Sandbox Code Playgroud)

revset语言非常丰富,允许根据日期,用户名,提交消息,是否存在特定远程位置的提交等来选择变更集.

git是否具有用于查询变更集的等效机制,无论是在核心程序中还是作为扩展可用?

dav*_*idg 4

git-branchless工具套件现在包括命令下的类似于 revset 的语言git branchless query

在当前存储库上安装并初始化后,可以按如下方式查询上一个问题(八年前!)中的示例:

# List patches not yet been merged into the branch default:
git branchless query "all() - ancestors('default')"
Run Code Online (Sandbox Code Playgroud)
# List patches between the revision tagged 1.3 and the revision tagged
# 1.5 which which mention "bug" and affect a file in the directory hgext
git branchless query "1.3::1.5 and message('bug') and paths.changed('glob:hgext/*')"
Run Code Online (Sandbox Code Playgroud)

这些与 HG 等价物非常相似。