AUTOREVISION(1)
π AUTOREVISION(1) β the manual page, but make it cute π
okay bestie, welcome to autorevision(1), section 1 of the manual. this is the whole page, every last crumb, but delivered with the energy it deserves. grab a boba, we're doing this. π§β¨
π NAME π
autorevision β extract current-revision metadata from version-control repositories. literally what it says on the tin, no cap. it goes into your repo and pulls out the receipts about the head revision. π
π¦ SYNOPSIS π¦
autorevision -t <output-type> [-o <cache-file> [-f] ] [-e <name>] [-U]
[-C <path>] [-q]
autorevision -s <symbol> [-o <cache-file> [-f] ] [-e <name>] [-U] [-C
<path>] [-q]
autorevision -V
three moods, pick one. that's the vibe check. π
β¨ DESCRIPTION β¨
so. autorevision extracts metadata about the head revision from your repository. it's giving "backstage pass to your git history."
this program is meant to be used by project build systems to extract properties that can be used in version strings. like, that's its whole purpose, that's its main character arc. π«Ά
and the range?? it can emit source files containing variable and macro definitions suitable for use with C, C++, Java, Mac info.plist, sh, Python, Perl and many other types of files β the full list is below, bestie, we're getting to it.
the generated source is written to the standard output. so pipe it, redirect it, do what you want with it. π
this program can normally be called from anywhere within a repository copy. okay but here's the tea though:
- under bzr the copy must be of a branch, not a full multibranch repository.
- under Subversion it must be called under a repository checkout, not the repository itself.
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. and 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. iconic behavior honestly. π₯
π Valid Repository Types π
- Git: a version greater than
1.7.2.3is recommended. - Mercurial: a version greater than
1.6is recommended. - Subversion: any production version.
- Bazaar: any production version.
πΈ Valid Output Types πΈ
clojureβ a clojure source file setting clojure variables.cβ a C/C++ source file.autorevision_declr.hin the contribs dir is provided for use with this output.
cmakeβ a cmake script file.csharpβ C# file withAutorevisionclass.hβ a header file suitable for C/C++.hppβ alternate C++ header file with namespace. Namespace is assigned fromVCS_BASENAME.iniβ a ini source file setting ini variables.javaβ a Java source file setting class properties.javapropβ a Java properties file (like ini); useful whenMETA-INFis readable in Java.jsβ a javascript source file setting javascript variables.jsonβ a JSON format file.luaβ a lua source file setting lua variables.m4β an m4 source file defining m4 macros.matlabβ Matlab output.octaveβ Octave output.phpβ a PHP source file setting PHP variables.plβ a Perl source file setting Perl variables (perlis an acceptable synonym).pyβ a Python source file setting Python variables (pythonis an acceptable synonym).rpmβ a RPM spec file format setting spec file macros.schemeβ a scheme source file setting scheme variables.sedβ a sed script that replaces symbol names enclosed in@symbols. It uses the|character as a separator in the sed commands. You can run it usingsed -f script.sed file-to-edit.shβ a text file suitable for including from a bash script. Will work with Ruby.swiftβ a Swift source file setting Swift global constants.- Unless set
VCS_EXTRAand any symbols that are missing because of repository support are set tonil.
- Unless set
texβ a TeX source file defining TeX macros. Note that the symbols are given different names since the underscore has a special meaning in TeX. For example,VCS_SHORT_HASHis renamed to\vcsShortHash.xcodeβ a header like output for use with xcode to populateinfo.pliststrings.
π Valid Symbol Names π
VCS_TYPEβ the repository type β"git","hg","bzr", 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,autorevisionwill attempt to navigate up thoughtrunk,branches, andtagsdirectories 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_UUIDβ a universally unique identifier, generated from the root commit in git and hg; for svn it uses the supplied UUID.- For git we choose the oldest commit if there is more than one.
- Not currently implemented for bzr.
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 whenautoversionwas run.- Under git, this will normally be the shortname of the current branch (the asterisked line in the output 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 symbol is filled with the current bookmark if it exists, with the current branch name as a fallback.
- Under Subversion this will normally be either
trunkor the basename of some branch or tag subdirectory, depending on whereautoversionwas run. - Under bzr, this is the nick of the branch you are on.
- Under git, this will normally be the shortname of the current branch (the asterisked line in the output of
VCS_TAGβ the name of the most recent tag ancestral to the current commit.- Empty under Subversion.
VCS_TAG_OPENPGPβ the fingerprint OpenPGP of the key that that signed the current tag.- Blank if the current tag is not signed or if no tags exist.
- Currently only implemented for git.
VCS_TICKβ a count of commits since most recent tag ancestral to the current commit or an alias ofVCS_NUMif there are no prior tags.- Empty under Subversion.
VCS_EXTRAβ a symbol set aside specifically to be set by the user through the environment or via scripts.- Additionally, the name of this symbol may be customized as well. (See
-efor more info.)
- Additionally, the name of this symbol may be customized as well. (See
VCS_ACTION_STAMPβ an "action stamp" consists of an RFC3339 timestamp in Zulu time, followed by an exclamation point, followed by an RFC822 address (technically, an "addr-spec" as defined in 6.1).- For svn the second part is simply the author name.
- Not currently implemented for bzr.
VCS_FULL_HASHβ a full unique identifier for the current revision.VCS_COMMIT_OPENPGPβ the fingerprint OpenPGP of the key that that signed the current revision.- Blank if the current revision is not signed.
- Currently only implemented for git.
VCS_SHORT_HASHβ a shortened version ofVCS_FULL_HASH, butVCS_FULL_HASHif it cannot be shortened.VCS_WC_MODIFIEDβ set to1if the current working directory has been modified and0if not. If the output language has native Boolean literals,truewill mean modified andfalseunmodified. The C/C++ output is left as numeric so the preprocessor can test it.- Untracked files are not ignored; see
-Ufor details.
- Untracked files are not ignored; see
π OPTIONS π
-t<output-type>β sets the output type. It is required unless-sis specified; both-tand-scannot be used in the same invocation.-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-tis specified; both-tand-scannot be used in the same invocation.-o<cache-file>β sets the name of the cache file.-e<name>β sets the output name ofVCS_EXTRA. Defaults toVCS_EXTRA.-fβ forces the use of cache data even when in a repo; useful for speeding up subsequent runs if more than one output format is needed.-Uβ causes untracked files to be checked when determining if the working copy is modified for Subversion only. While this is the default behavior for all other repository types, it is off by default for Subversion because of speed concerns.-C<path>β change working directory to given path. This allowsautorevisionto extract metadata from repositories found at a specific path to support VPATH or out-of-source builds.-qβ silence warnings.-Vβ emits theautorevisionversion and exits.
π BUGS π
okay so here's where we keep it real, bestie. no glossing over this part.
- the bzr extractor is not very well tested. π«£
- when a git repo is actually a git-svn remote, this tool tries to do the right thing and return a Subversion revision. the bug is that the detector code for this case is somewhat unreliable; you will get the hash instead if your configuration doesn't use
svn-remote.svn.url. - nested repositories, particularly repositories of different types, may result in incorrect and unintended behavior.
- unpacking a tarball into a repository will result in incorrect and unintended behavior.
fr fr, read those last two again before you yell at the tool. it warned you. π
β NOTES β
development of autorevision is carried out at https://github.com/Autorevision/autorevision
HTML rendered docs and usage examples can be found at https://autorevision.github.io/
π 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/m4 support, svn and bzr extraction, git-svn support, CLI design, man page.
See AUTHORS.txt for a full list in order of number of contributions. π«Ά
and that's the whole page, bestie. this was version 1.22, dated 2021-01-25, out of section AUTOREVISION(1) of the manual β slay, periodt, go extract some metadata. πβ¨π¦
π¦ where this page comes from
- debian bookworm: autorevision 1.22-2 Β· MIT
- debian trixie: autorevision 1.22-2 Β· MIT
- nixos 26.05: autorevision 1.22
- nixpkgs unstable: autorevision 1.22
- ubuntu jammy: autorevision 1.22-2 Β· MIT
- ubuntu noble: autorevision 1.22-2 Β· MIT
- ubuntu resolute: autorevision 1.22-2build1 Β· MIT
- ubuntu stonking: autorevision 1.22-2build1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms