Commit graph

3 commits

Author SHA1 Message Date
Linus Torvalds
34fb8240da git repository reading: start reading the actual file contents
If we want to scale to thousands of dives, we'll eventually want to read
the dive computer files lazily when actually needed, but for now we do
everything synchronously.  Even if that may actually be slower than
parsing one big XML file.

The git object store is pretty efficient, but especially with some
history, the compression and delta application will certainly not be
free.

This does all the git object unpacking, but none of the actual data
parsing yet.  But as part of looking up the file objects, we do get the
dive number (which is in the name of the dive file).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-09 19:36:33 -07:00
Linus Torvalds
f0985644b6 git dive loading: actually insert the dives into the dive table
The biggest part of this commit is the comment about the woeful state of
the "git_tree_walk()" interface - the interface is not really very good
for seeing any recursive state, since it just walks the tree pretty much
linearly.

But the only real recursive state we care about is the trip, and in all
normal situations the "trip this dive is in" is the same thing as "what
was the last trip directory we traversed", so a linear walk works fine.

The one exception is if a dive isn't in a trip at all, in which case
"last trip directory" obviously isn't what we want.

But rather than do our own tree walking by hand (and just passing the
trip information in the natural recursive manner when traversing the
tree), we hack around it by just looking at the path to the dive.

That one-liner trivial hack has now generated about 20 lines of
explanation of it.

ANYWAY.  With this, we parse the dive and trip hierarchy properly, and
instead of just printing out the data, we might as well insert the dives
and trips into the subsurface data structures.

Note: the only data we have about the dive and trip right now is what is
visible in the directory structure, since we don't look at the actual
dive file at all (not even the name of it, which contains the dive
number).  So the end result will be just a sea of empty dives and the
trips they are contained in.  The dives have a date and time, and the
trip has a date, though.

So this is *not* useful for actually saving and loading data, but the
data we do load is easily visualized inside subsurface, so as I'm
starting to add real dive data parsing code, it will all be much more
visually satisfying.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-09 19:36:32 -07:00
Linus Torvalds
cc3a184adf Add initial parser for git trees
It doesn't actually parse the files themselves, but it does walk the
object tree and print out the dives and trips it finds.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-08 07:46:50 -08:00