If a source and destination files are supplied, GitWCRev copies source to destination, performing keyword substitution as follows:
Table 3.3. List of available keywords
Keyword | Description |
---|---|
$WCREV$ | Replaced with the HEAD commit revision of the working tree. |
$WCREV=n$ | Replaced with the HEAD commit revision of the working tree, trimmed to n chars. For example: $WCREV=7$ |
$WCBRANCH$ | Replaced with the name of the current branch (or SHA-1 if HEAD is detached) of the working tree. |
$WCLOGCOUNT$, $WCLOGCOUNT&$, $WCLOGCOUNT+$, $WCLOGCOUNT-$ | Replaced with the number of first-parent commits from HEAD back to the first commit. This number is guaranteed to increase with every commit on the very same branch as long no history is rewritten and can be used as part of a version number (see https://gcc.gnu.org/ml/gcc/2015-08/msg00148.html and https://gitlab.com/tortoisegit/tortoisegit/merge_requests/1 for more details). The $WCLOGCOUNT&$ , $WCLOGCOUNT+$ and $WCLOGCOUNT-$ can be used to AND , add or subtract a predefined number from/to the number of commits. For example $WCLOGCOUNT&65535$ will ensure the number is not exceeding 16 bit. |
$WCDATE$, $WCDATEUTC$ | Replaced with the commit date/time of the highest commit revision. By default, international format is used: yyyy-mm-dd hh:mm:ss . Alternatively, you can specify a custom format which will be used with strftime() , for example: $WCDATE=%a %b %d %I:%M:%S %p$ . For a list of available formatting characters, look at the online reference . |
$WCNOW$, $WCNOWUTC$ | Replaced with the current system date/time. This can be used to indicate the build time. Time formatting can be used as described for $WCDATE$ . |
$WCMODS$ | $WCMODS?TText:FText$ is replaced with TText if there are local modifications in the passed path, or FText if not. This will also evaluate to true if a submodule is checked out at a different commit (requires submodules not to be ignored). |
$WCFILEMODS$ | $WCFILEMODS?TText:FText$ is replaced with TText if there are local modifications in the passed path, or FText if not. This does not check the checked out commit of submodules. |
$WCUNVER$ | $WCUNVER?TText:FText$ is replaced with TText if there are unversioned items in the passed path, or FText if not. |
$WCISTAGGED$ | $WCISTAGGED?TText:FText$ is replaced with TText if the HEAD commit is tagged, or FText if not. |
$WCINGIT$ | $WCINGIT?TText:FText$ is replaced with TText if the entry is versioned, or FText if not. The result for directories is false , the only exception is the repository root. |
$WCSUBMODULE$ | $WCSUBMODULE?TText:FText$ is replaced with TText if the passed path contains a submodules, or FText if not. |
$WCSUBMODULEUP2DATE$ | $WCSUBMODULEUP2DATE?TText:FText$ is replaced with TText if all submodules are checked out at the version specified in the index of the parent working tree, or FText if not. |
$WCMODSINSUBMODULE$ | $WCMODSINSUBMODULE?TText:FText$ is replaced with TText if a submodule contains uncommitted changes, or FText if not. |
$WCUNVERINSUBMODULE$ | $WCUNVERINSUBMODULE?TText:FText$ is replaced with TText if a submodule contains unversioned items, or FText if not. |
$WCMODSFULL$ | $WCMODSFULL?TText:FText$ combines is $WCMODS$ and $WCMODSINSUBMODULE$ and can be seen as a recursive check. replaced with TText if the passed path or any submodule under the passed path contains uncommitted changes, or FText if not. |
$WCUNVERFULL$ | $WCUNVERFULL?TText:FText$ combines is $WCUNVER$ and $WCUNVERINSUBMODULE$ and can be seen as a recursive check. replaced with TText if the passed path or any submodule under the passed path contains unversioned items, or FText if not. |
GitWCRev does not directly support nesting of expressions, so for example you cannot use an expression like:
#define SVN_REVISION "$WCUNVER?$WCNOW$:$WCDATE$$"
But you can usually work around it by other means, for example:
#define DATE_NOW $WCNOW$ #define DATE_COMMIT $WCDATE$ #define DATE "$WCUNVER?DATE_NOW:DATE_COMMIT$"
Some of these keywords apply to single files rather than to an entire working tree, so it only makes sense to use these when GitWCRev is called to scan a single file. This applies to $WCINGIT$
.