C++ include file with revision id

guerinp at magic.fr guerinp at magic.fr
Wed Aug 27 00:57:37 BST 2008


Hello John,

It's the way I do to produce my include file

    #!/bin/sh
    nickname=`bzr version-info --custom --template="{branch_nick}"`
    bazaar_revid=`bzr version-info --custom --template="{revision_id}"`
    echo "#define `echo ${nickname}_revid|tr '[:lower:]' '[:upper:]'` 
    \"${bazaar_revid}\"" > include/${nickname}_manifest.h

For now this file is generated after the commit was done.
But as the file is not versionned and generated in the working directory 
and thus imply the following
1/ "commit --strict" gives an error if this file is not versionned or 
ignored
2/ "bzr export" does not take this file in account because it's not 
versionned though it is necessary to have a complete standalone release.

I already have modified, as a plugin, the export command to use the 
commit timestamp instead of the current time
by replacing "now" by "mtime" in the exporter functions where
    mtime = tree.get_file_mtime(ie.file_id)
Is it possible to access to this file in the working tree inside the 
exporter functions to include it in the archive ?

Kind regards
Patrice.
John Arbash Meinel a écrit :
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> guerinp at magic.fr wrote:
>   
>> Hello All,
>>
>> After modifying C++ source files and commited them, I want to produce a
>> file containing the revison id, as in the User's reference doc example,
>> that will be available for the compilation and production process.
>> 1/ I need that the revid file be available for export, so I suppose that
>> it should be versionned.
>> 2/ Is it possible to produce such a file just before the commit but once
>> the new revid is known.
>>
>> It seems to be like Circle's quadrature and cannot be achived without
>> the help of external tools
>>
>> Kind regards
>>     
>
> This is generally not something you would want to version, as it would change
> with every commit, and cause conflicts when merging, etc.
>
> In general, I would use:
>
> bzr version-info --custom --template="...." > version.cpp
>
> See "bzr help version-info" for more information on how to define a template.
>
> John
> =:->
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFItGpwJdeBCYSNAAMRAln6AJ9zfj2CE6sNoV/8+wE0SooReMwpyACgxZWu
> bACWVDWEFDYqax2eeiTpa3k=
> =1xQo
> -----END PGP SIGNATURE-----
>
>
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/bazaar/attachments/20080827/8e6cfad2/attachment.htm 


More information about the bazaar mailing list