Fossil 可以将立即提交的 SHA1 校验和插入到文件中吗?

发布于 2024-10-05 03:42:08 字数 139 浏览 1 评论 0原文

假设我想将新版本提交到存储库中,但我想自动将新提交的校验和(我未知)插入到也需要我提交的文件(或文件中的某个位置)中。 有没有办法在化石中做到这一点?或者是否可以告诉化石在每次提交之前运行可执行文件或脚本,以便我可以自动编辑文件以插入校验和?

谢谢

Say I want to commit a new version into the repository, but I'd like to automatically insert the checksum of that new commit (unknown to me) into a file (or somewhere into a file) that also needs to me commited.
Is there any way to do this in fossil?, or could it be possible to tell fossil to run an executable or script before every commit so I could automatically edit a file to insert the checksum?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

明月松间行 2024-10-12 03:42:08

文件 manifest.uuid 包含提交的校验和,文件 manifest 包含该提交中的文件列表及其各自的校验和。 (manifest.uuid 只是清单的 SHA1)。这两个文件都是纯文本且易于解析。

化石本身的构建表明了一种用途。构建时,文件 manifest.uuid 使用 awk 转换为 "[1234567890]" 形式的 C 字符串文字,并用于形成出现在所有 html 页面页脚中的修订名称文本。

请注意,最新版本的 Fossil 不会留下这些文件,除非使用 fossil 设置清单 1 等命令启用“清单”设置。

或者,您可以解析 fossil infofossil status 的输出,两者都包含当前结帐 ID 的值。

对于单个文件,fossil finfo 将报告文件的完整更改历史记录,其中包含该文件在每个时间点的工件 ID。可以解析该文件的工件 ID。更好的是,fossil sha1sum 将报告任何文件(或多个文件或标准输入)的 SHA1 总和。文件的 SHA1 总和是其工件 ID。

由于整个签入的 id 只是其清单的 SHA1,其中包含每个签入文件的 SHA1,因此实际上不可能将签入的 id 包含在签入的文件中。

The file manifest.uuid contains the checksum of the commit, and the file manifest contains a list of the files in that commit and their individual checksums. (manifest.uuid is just the SHA1 of manifest). Both files are plain text and easy to parse.

The build for fossil itself shows one use. When building, the file manifest.uuid is converted with awk) to a C string literal of the form "[1234567890]" and used to form the text of the revision name that appears in all html page footers.

Do note that recent versions of fossil don't leave those files behind unless the "manifest" setting is enabled with a command like fossil setting manifest 1.

Alternatively, you can parse the output of fossil info or fossil status, both of which include the value of the current checkout's id.

For a single file, fossil finfo will report the file's complete change history, which does include the artifact id for that file at each point in time. It could be parsed for the artifact id of that file. Better, fossil sha1sum will report the SHA1 sum of any file (or files, or stdin). The SHA1 sum of a file is its artifact id.

Since the id of an entire checkin is just the SHA1 of its manifest which includes the SHA1's of each checked in file, it is effectively impossible to include the id of the checkin inside a file checked in.

混吃等死 2024-10-12 03:42:08

由于编辑文件以插入其校验和会更改校验和,因此这是不可能的。

我相信放置在每个结帐根部的清单(无扩展名)文件确实包含某种校验和(如果解析是可以接受的)。

Since editing a file to insert its checksum would change the checksum, that is not possible.

I believe the manifest (no extension) file placed at the root of every checkout does contain some sort of checksum, if parsing that is acceptable.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文