To get the checkout version into your app, one way (I've been using successfully) is this:

With the help of a little script (like the following Lua one) extract the checkout version into a file that is included from your app. This file is generated as part of the make build process and is itself not part of the repo, i.e., 'fossil clean' removes it.

(You'll have to change the fo:write(...) line according to your requirements.)

--==============================================================================
-- Creates checkout.inc file for including Fossil checkout version in source
--==============================================================================

function run(cmd)
assert(type(cmd) == 'string','cmd should be the string of the command to run')
 print('Running...',cmd)
 local f = io.popen(cmd)
 local ans = f:read('*a')
 f:close()
 return ans
end

ans = run('f tim current')

fo = io.open('checkout.inc','w')
for line in ans:gmatch('%[(%x+)%].+%*CURRENT%*') do
 fo:write("                    fcc       ' * "..line.."'")
end
fo:close()

--==============================================================================

-----Original Message----- From: Michael Weise
Sent: Monday, July 13, 2015 10:45 AM
To: fossil-users@lists.fossil-scm.org
Subject: [fossil-users] Automatically put version / checkout infomation into source code on commit

Dear all,

we've been using fossil for over a year now and are quiet happy with it.

The next thing we'd like to do is to automatically put some version
infomation from the fossil repository into the sourcecode. This will
help us to know which checkout version was used for a specific build /
executable.

1. Is this possible with fossil?
2. What approach can you recommend?

Thanks,
Michael


PS: Programming language used is C++
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
_______________________________________________
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