C++ include file with revision id

Nicholas Allen allen at ableton.com
Wed Aug 27 10:35:41 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
Is this not something that can be achieved with keyword expansion?
https://launchpad.net/bzr-keywords

Nick

guerinp at magic.fr wrote:
> 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 : 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.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
 
iD8DBQFItR/sbpmWsXfOU58RAngvAJ0f1NWGi9LpBWqIvusvDaaOaFngQgCfdqMN
VbwoioYTYbdn9N085arIzsQ=
=IWJY
-----END PGP SIGNATURE-----




More information about the bazaar mailing list