Can Fossil insert the SHA1 checksum of an immediate commit into a file?
Say I want to commit a new version into the repository, but I'd like to au开发者_JAVA技巧tomatically 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
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.
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.
精彩评论