autorevision - extract head metadata from version-control repositories
autorevision extracts metadata about the head version of your repository.
This program is meant to be used by project build systems to extract properties that can be used in software version strings. It can emit source files containing variable and macro definitions suitable for use with C, C++, sh, Python, Perl, Mac info.plist and other types of files (see below for the full list).
The generated source is written to standard output.
This program must be called from the top-level (root) directory of a repository. Exception: it can be called from any level of a Subversion checkout directory, but not from within a Subversion repository directory.
If you specify a cache file, then when autorevision is run where no repository can be recognized, the values from the cache file will be used instead. If a repository can be recognized, the cache is rewritten. This feature makes it possible for your build to run from an unpacked tarball that includes the cache file.
Git: A version greater than 1.7.2.3 is recommended.
Mercurial: A version greater than 1.6 is recommended.
Subversion: Any production version. Warning: due to limitations in Subversion this program can run very long on large Subversion repositories.
- h
-
A header file suitable for C/C++.
- xcode
-
A header output for use with xcode to populate info.plist strings.
- sh
-
A text file suitable for including from a bash script. Will work with Ruby.
- py
-
A Python source file setting Python variables.
- pl
-
A Perl source file setting Perl variables.
- lua
-
A lua source file setting lua variables.
- php
-
A PHP source file setting PHP variables.
- ini
-
A ini source file setting ini variables.
- js
-
A javascript source file setting javascript variables.
- VCS_TYPE
-
The repository type - "git", "hg", or "svn".
- VCS_BASENAME
-
The basename of the directory root. For most VCSes this will simply be the basename of the repository root directory. For Subversion, autorevision will navigate up though trunk, branches, and tags directories to find the actual root.
- VCS_NUM
-
A count of revisions between the current one and the initial one; useful for reporting build numbers.
- VCS_DATE
-
The date of the most recent commit in true ISO-8601/RFC3339 format, including seconds.
- VCS_BRANCH
-
The current branch. For VCSes with true branches this returns the branch name. Under Subversion, only returns a nonempty string when autorevision is run from within a subdirectory of a 'branches' directory, in which case it returns the subdirectory basename.
- VCS_TAG
-
The exact current tag or a synonym for
VCS_BRANCH
if not currently on a tag; useful to to rely on for a version string. Empty under Subversion. - VCS_FULL_HASH
-
A full unique identifier for the current revision.
- VCS_SHORT_HASH
-
A shortened version VCS_FULL_HASH, but VCS_FULL_HASH if it cannot be shortened.
- VCS_WC_MODIFIED
-
Set to 1 if the current working directory has been modified and 0 if not. If the output language has native Boolean literals, true will mean modified and false unmodified.
- -t 'output-type'
-
Sets the output type. It is required unless -s is specified; both -t and -s cannot be used in the same invocation.
- -o 'cache-file'
-
Sets the name of the cache file.
- -s 'symbol'
-
Changes the reporting behavior; instead of emitting a symbol file to stdout, only the value of that individual symbol will be reported. It is required unless -t is specified; both -t and -s cannot be used in the same invocation.
- -V
-
Emits the autorevision version and exits.
dak180 <[email protected]>: concept, bash/C/C++/XCode/PHP/ini support, git and hg extraction. Eric S. Raymond <[email protected]>: Python/Perl support, svn extraction, CLI design, man page.