Skip to content

Latest commit

 

History

History
157 lines (114 loc) · 4.83 KB

autorevision.asciidoc

File metadata and controls

157 lines (114 loc) · 4.83 KB

AUTOREVISION(1) Manual Page

NAME

autorevision - extract head metadata from version-control repositories

SYNOPSIS

autorevision {-t output-type | -s symbol} [-o cache-file] [-V]

DESCRIPTION

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++, Java, 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.

Valid Repository Types

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 take a very long time to report on large Subversion repositories.

Valid Output Types

h

A header file suitable for C/C++.

ini

A ini source file setting ini variables.

java

A Java source file setting class properties.

javaprop

A Java properties file (like ini); useful when META-INF is readable in Java.

js

A javascript source file setting javascript variables.

lua

A lua source file setting lua variables.

php

A PHP source file setting PHP variables.

pl

A Perl source file setting Perl variables.

py

A Python source file setting Python variables.

sh

A text file suitable for including from a bash script. Will work with Ruby.

xcode

A header output for use with xcode to populate info.plist strings.

Valid Symbol Names

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 name of the branch of the commit graph that was selected when autoversion was run. Under Subversion this will normally be either 'trunk' or the basename of some branch or tag subdirectory, depending on where autoversion was run. Under git, this will normally be the shortname of the current branch (the asterisked line in the output of of "git branch") except that when the branch doesn’t have a shortname it will be a full refspec. Under hg the feature that is called 'branches' is actually a sort of graph coloring (multiple heads can have the same branch name) so this variable is filled with the current bookmark if it exists, with the current branch name as a fallback.

VCS_TAG

The name of the most recent tag ancestral to the current commit. Empty under Subversion.

VCS_TICK

A count of commits since most recent tag ancestral to the current commit or an alias of VCS_NUM if there are no prior tags. 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.

OPTIONS

-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.

-f

Forces the use cache data even when in a repo; useful if you want to preprocess the data before final output.

-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.

AUTHORS

dak180 <dak180@users.sf.net>: concept, bash/C/C++/XCode/PHP/ini support, git and hg extraction. Eric S. Raymond <esr@thyrsus.com>: Python/Perl/lua support, svn extraction, CLI design, man page.