On Mon, Dec 12, 2011 at 6:29 PM, Christopher Berardi
<cbera...@natoufa.com>wrote:

> Let's say I have a test console program for *nix systems, named 'testprog'
> that
> I have in source control via Fossil. Now, each time I make a commit, it
> generates a new version number. What I am looking for is how to output that
> version number to the console like so:
>
>    $ testprog --version
>    testprog Version [8b73c285a1] 2011-12-12 08:32:12
>

Fossil does this itself.  The trick is to do "fossil set manifest on" and
then look at the "manifest" and "manifest.uuid" files that Fossil generates
automatically.  For Fossil, the relevant part of the Makefile is here:

    http://www.fossil-scm.org/fossil/artifact/ba0f0532a06?ln=295-296

The rules above run a program "mkversion" over the "manifest" and
"manifest.uuid" files.  This program outputs a header file named
"VERSION.h" that looks like this:

  #define MANIFEST_UUID "9c90b0f0522c2fc3b8842f459bea910d7f8417c6"
  #define MANIFEST_VERSION "[9c90b0f052]"
  #define MANIFEST_DATE "2011-12-06 00:09:09"
  #define MANIFEST_YEAR "2011"
  #define RELEASE_VERSION "1.21"
  #define RELEASE_VERSION_NUMBER 121

Source code to the "mkversion" program is here:

     http://www.fossil-scm.org/fossil/artifact/f2a3e37f7fd400f?ln

The mkversion program used to be a script, but that was difficult to port
to windows, so we turned it into a (more complex) C program.

SQLite also does this.  It too reads the "manifest" and "manifest.uuid"
files to get the information it needs.  But SQLite runs a TCL script that
inserts the information into the generated "sqlite3.h" header file.  That
script is here:

     http://www.sqlite.org/src/artifact/78013ad79a5e?ln



>
> Also, I noticed that as of about 2 Fossil versions ago, there is support
> for
> sequential versioning, which I think is great for trying to figure out if
> you
> have the latest version or are out of date. But, I'm fuzzy on how do I
> assign
> that number? How do I tell Fossil that this checkin is Version 1.1? And
> what
> formats are available (e.g., Major.Minor [1.2], Major.Minor.Bugfix
> [2.3.43],
> etc.)? And will it automatically be put into the console output like so?
>
>    $ testprog --version
>    testprog Version 3.1.4 [8b73c285a1] 2011-12-12 08:32:12
>
>
> Thank you.
>
> --
> Christopher Berardi
> http://www.natoufa.com/
>
> Be still, and know that I am God (Psalms 46:10)
> _______________________________________________
> 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

Reply via email to