3.2. Keyword Substitution

TortoiseGit

3.2. Keyword Substitution

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 in the working tree.
$WCREV=n$ Replaced with the HEAD commit revision in the working tree, trimmed to n chars. For example: $WCREV=7$
$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, or FText if not. This will also evaluate to true ff 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, 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 working tree, 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.
$WCSUBMODULE$ $WCSUBMODULE?TText:FText$ is replaced with TText if the working tree has 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 working tree or any submodule 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 working tree or any submodule 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$"
      

[Tip] Tip

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