Re: [fossil-users] Most "future-proof" way to query fossil repositories (and checked out copies!)

2013-01-09 Thread Richard Hipp
On Wed, Jan 9, 2013 at 3:45 PM, wrote:

> Hello.
>
> I'm working on a Fossil plugin for Jenkins (http://jenkins-ci.org), and
> in order to implement the plugin, I have to query fossil repositories
> in various ways.
>
> I'm calling the fossil executables for cloning, pulling, and opening
> repositories, but I'm not exactly sure what I should be doing for
> queries such as "What version is checked out in the current directory?"
> and "Have any commits been made on branch B since this version was
> checked out?"
>
> Should I be opening the repositories as SQLite databases and querying
> the tables? Is the schema subject to change constantly?


The schema is subject to change.  And years ago it would change on a regular
basis.  But the schema is mostly stable now.  There may be tweaks here and
there, but it mostly it will likely be the same.

The schema for the repository is divided into two parts, the "content
schema" and
the "auxiliary schema".  The content schema contains primary information.
The
auxiliary schema contains values computed from the primary schema when you
run "fossil rebuild" or make other changes.  The auxiliary schema is
basically a
cache for information that is contained in the content schema but which is
difficult to compute on-the-fly.

Two entries in the CONFIG table contain version numbers for these two
schemas:

SELECT * FROM config WHERE name GLOB '*-schema';

So you can monitor those two values to see if the schema changes out from
under you.

The schema for the ".fslckout" database is separate.  It is unversioned,
unfortunately.



> For that
> matter, should I be parsing the output of the commands? Is the format
> of the output subject to unannounced changes?
>
> Personally, I'd rather use SQL than parse text...
>
> Regards,
> M
> ___
> fossil-users mailing list
> fossil-users@lists.fossil-scm.org
> http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
>



-- 
D. Richard Hipp
d...@sqlite.org
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] Most "future-proof" way to query fossil repositories (and checked out copies!)

2013-01-09 Thread org.fossil-scm.fossil-users
On Wed, 9 Jan 2013 15:53:25 -0500
Richard Hipp  wrote:
>
> The schema is subject to change.  And years ago it would change on a
> regular basis.  But the schema is mostly stable now.  There may be
> tweaks here and there, but it mostly it will likely be the same.
> 
> The schema for the repository is divided into two parts, the "content
> schema" and
> the "auxiliary schema".  The content schema contains primary
> information. The
> auxiliary schema contains values computed from the primary schema
> when you run "fossil rebuild" or make other changes.  The auxiliary
> schema is basically a
> cache for information that is contained in the content schema but
> which is difficult to compute on-the-fly.
> 
> Two entries in the CONFIG table contain version numbers for these two
> schemas:
> 
> SELECT * FROM config WHERE name GLOB '*-schema';
> 
> So you can monitor those two values to see if the schema changes out
> from under you.
> 
> The schema for the ".fslckout" database is separate.  It is
> unversioned, unfortunately.
> 

Thanks!

It should be reasonably easy to stay current as I don't exactly need
much out of the databases.

I think I *may* be reasonably safe with the .fslckout database as it
seems I only need a single value: the 'checkout' row from the 'vvar'
table.

Regards,
M
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] Most "future-proof" way to query fossil repositories (and checked out copies!)

2013-01-09 Thread Sverre
Den Wed, 09 Jan 2013 21:45:31 +0100 skrev  
:



Hello.

I'm working on a Fossil plugin for Jenkins (http://jenkins-ci.org), and
in order to implement the plugin, I have to query fossil repositories
in various ways.

I'm calling the fossil executables for cloning, pulling, and opening
repositories, but I'm not exactly sure what I should be doing for
queries such as "What version is checked out in the current directory?"
and "Have any commits been made on branch B since this version was
checked out?"

Should I be opening the repositories as SQLite databases and querying
the tables? Is the schema subject to change constantly? For that
matter, should I be parsing the output of the commands? Is the format
of the output subject to unannounced changes?

Personally, I'd rather use SQL than parse text...

Regards,
M
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


I don't know what is the best way to proceed, but I have used the  
following script to get the current version and the latest version for  
comparison. Maybe you can draw some ideas from it. It requires the working  
directory to be an opened fossil check-out.


Example script (snippet):


# Fossil binary
fossil="/bin/fossil"
# sed script for getting the identifier of a check-in
uuid="s/uuid: *\(.*\)$/\1/p"
# Get the current version of the repository
current="$("$fossil" info current | sed -n "$uuid")"
# Get the version of the tip
tip="$("$fossil" info tip | sed -n "$uuid")"


If current and tip are equal, an update should be unnecessary.

Regards,
Sverre
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users