<commit_before>Autorevision
============

A script for extracting version information useful in release/build scripting from repositories.

To use pass a type and a path to the cache file (if any) or a cache file and the desired single varible to output:

```bash
./autorevision {-t <output_type> | -s <VARIABLE>} [-o <cache_file>] [-V]
```

All output (except for the cache file) will be piped to stdout.
A cache file is required for autorevision to output anything outside of a repository.

For a list of the variables you can pass see the *Currently Extracted Data* section.

**Note**: The script must be run at the root level of the repository from which to extract information; the path to the output file should always be relative to the root of the repo, not the location of the script.


Currently Supported Output Types
--------------------------------

`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 with variables defined.

`py`: A Python source file setting Python variables.

`pl`: A Perl source file setting Perl variables.


Currently Supported 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

Currently Extracted Data
------------------------

`VCS_TYPE`: The repository type - `git`, `hg`, or `svn`.

`VCS_BASENAME`: The basename of the directory root.

`VCS_NUM`: A count of revisions there have been between the current one and the initial one; useful for build numbers.

`VCS_DATE`: The date of the current commit in true ISO-8601/RFC3339 format, including seconds.

`VCS_URI`: Repository dependent: for Git the full refspec & for Mercurial the bookmark or the branch if there is no bookmark, empty for Subversion; meant to provide information on the current head's name.

`VCS_TAG`: The exact current tag or a synonym for `VCS_URI` 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` or a synonym for `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.<commit_msg>Now had we have a manual page, README.md should be a teaser.<commit_after>Autorevision
============

A program for extracting version information useful in release/build scripting from repositories.  

Supported repository types include git, hg, and svn. The renord can be emitted in a ready-to-use form for C, C++, bash, Python, Perl, or XCode. 

Emitted information includes the ID of the most recent commit, its branch, its date, and several other usaefil pieces of metainformation.

There is support for reasding and writing a cache file so autorevision will remain useful during a buld from an unpacked distrubution tarball.

See the manual page, included in the distribution, for invocation details.

{'fraction_non_alphanumeric': 0.09419394688079061, 'fraction_numerical': 0.004941321803582459, 'mean_word_length': 3.870676691729323, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3412652', 'n_tokens_mistral': 906, 'n_tokens_neox': 840, 'n_words': 475}