On Sun, 06 Nov 2011 11:19:08 +0100
Gilles <[email protected]> wrote:

> I'd like to check something about how Fossil works.
> 
> When I run "fossil commit", it saves the changes made to all the files
> that are monitored (ie. that have been added to the repository).
One usually uses the term "tracked" (instead of "monitored", which usually 
implies some real-time monitoring of the filesystem for changes made in the 
work tree employed by some VCS's).

> When I run "fossil finfo" on a file, it shows two hashes:
> 
> C:\Projects\Project1>fossil finfo Form1.vb
> History of Projects/Project1/Form1.vb
> 2011-11-05 [6a07f19e02] Some comment (user: Joe, artifact:
> [9735460a2c])
> 2011-11-04 [367bcfa41a] Some comment (user: Joe, artifact:
> [da4cb1ce3b])
> 
> Am I correct in understanding that the first hash identifies the
> changes made to this particular file in that particular commit, while
> the second hash identifies the commit that contains all the files that
> were part of the commit at that time?
> 
> For instance, if Form1.vb and Form2.vb were edited when I ran "fossil
> commit", the second hash would be the same for both files because they
> were commited together?
I think the meaning of these hashes is reversed: artifact is a particular 
version of a particular file according to [1], so the first hash here 
identifies the commit the artifact identified by the second hash is a part of.
You can verify this simply by correlating the output of `fossil finfo`
with the output of `fossil timeline`.

This is further complicated by the fact, the commit object itself is also an 
artifact, and both kinds of artifacts can be inspected using the
`fossil artifact` command, just for files it dumps the raw contents of those 
files, and for commits it dumps specially formatted machine-parseable output 
representing full info about the commit.

I'm not familiar with Fossil internals, so there may be other types of 
artifacts.

> Is there a command that I could run to list all the commits, and for
> each, would show which files were part of the commit?
I think there's no such command, but you could script that one for yourself 
using nothing more than `fossil artifact`:
1) Start from a particular tip's SHA-1 identifier.
2) Run `fossil artifact` on it--amont other things, you'll get the list
   of files belonging in to that commit, each prefixed with the "F " string,
   and the parent commit's SHA-1 identifier prefixed with the "P " string.
3) Extract the parent commit ID, goto (2).

Note that you might be under a mistaken assumption that Fossil records only the 
changed files in its commits, which it, being a DVCS, does not.
In a DVCS system, each commit refers to the full state of the repository
using SHA-1 (or whatever) hashes calculated on the contents (!) of the files it 
tracks to refer to the state of those files.
So it means if you have ten files and then record several commits each of which 
records a change to only one file of the set, each commit will still refer to 
all those ten files, just one of them will have different contents (and hence 
will be referenced by a different SHA-1 ID) compared to the other nine.

1. http://www.sqlite.org/debug1/doc/trunk/www/concepts.wiki
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to