Menu

Tree [3eaac4] default tip /
 History

Read Only access


File Date Author Commit
 .hgignore 2019-09-07 gshadow gshadow [a4037f] Update project and use self to generate --versi...
 .hgtags 2019-09-07 gshadow gshadow [1e0cda] Move 1.3 tag.
 LICENSE.txt 2019-09-07 gshadow gshadow [d09542] Add MIT license text.
 defines.h 2019-09-07 gshadow gshadow [091912] Add --class option help and rename DEFAULT_JAVA...
 in_git.cpp 2019-09-07 gshadow gshadow [45de96] Prepare for adding SVN and Git inputs and Java ...
 in_hg.cpp 2019-09-07 gshadow gshadow [6c784b] Fix cppcheck warnings.
 in_svn.cpp 2019-09-07 gshadow gshadow [45de96] Prepare for adding SVN and Git inputs and Java ...
 main.cpp 2019-09-07 gshadow gshadow [6c784b] Fix cppcheck warnings.
 out_cpp.cpp 2019-09-07 gshadow gshadow [6bb265] Add Java output and other modifications.
 out_java.cpp 2019-09-07 gshadow gshadow [6c784b] Fix cppcheck warnings.
 readme.md 2019-12-09 gshadow gshadow [3eaac4] Add usage examples and sample output.
 vcsinfo.cbp 2019-09-07 gshadow gshadow [a4037f] Update project and use self to generate --versi...
 ver.bat 2019-09-07 gshadow gshadow [a4037f] Update project and use self to generate --versi...
 version.bat 2019-09-07 gshadow gshadow [3ee102] Make use current vcsinfo build by default to ge...

Read Me

VCS Information Generator Tool

Allows to generate source code for your project's VCS (Version Control System) status.
Include this tool into your pre-build step to hardcode version strings.

  • vcsinfo.exe - Windows 64-bit build.
  • vcsinfo32.exe - Windows 32-bit build.

To get a help use --help argument.

Currently supported:

  • Inputs: Mercurial (hg), Git, Subversion (svn)
  • Outputs: C, C++, Java

Usage example:

Generate C header file for Mercurial repository with temporary file.
hg summary > version.txt
vcsinfo --hg --c version.txt version.h
del version.txt
Note that you could omit both -hg and --c as it is defaults.

Generate C header file for Mercurial repository using pipes.
hg summary | vcsinfo > version.h

Generate C++ header file for Mercurial repository in v1.x compatibility mode.
hg summary | vcsinfo --cpp --compat version.h

Generate Java class for Git repository treating new files as modification.
git status | vcsinfo --git --java --package com.test --newismod > version.java

Generate C header for Subversion repository ignoring properties change.
svn info && svn status | vcsinfo --svn --noprops > version.h

Sample output:

// Version Information
// Generated by the VCS Information Tool v2.0 (c) Denis Andreev, Built Sep  8 2019 at 00:42:26

#define MERCURIAL_REVISION   23u
#define MERCURIAL_MODIFIED  1
#define MERCURIAL_HASH         "6c784b7035ea"
#define MERCURIAL_BRANCH    "default"

#define VCS_REVISION   MERCURIAL_REVISION
#define VCS_MODIFIED  MERCURIAL_MODIFIED
#define VCS_HASH         MERCURIAL_HASH
#define VCS_BRANCH    MERCURIAL_BRANCH