关键字替换

如果提供了源文件和目的文件,SubWCRev 会复制源文件到目标文件,执行如下所属的关键字替换:

表 6.3. 可用关键字列表

关键字描述
$WCREV$用工作副本中最高的提交版本来替换
$WCREV&$用工作副本中的最高提交修订版本号替换,ANDed with the value after the & char. 例如:$WCREV&0xFFFF$
$WCREV-$, $WCREV+$Replaced with the highest commit revision in the working copy, with the value after the + or - char added or subtracted. For example: $WCREV-1000$
$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 在线引用.
$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$.
$WCRANGE$Replaced with the update revision range in the working copy. If the working copy is in a consistent state, this will be a single revision. If the working copy contains mixed revisions, either due to being out of date, or due to a deliberate update-to-revision, then the range will be shown in the form 100:200.
$WCMIXED$当有混合版本时用 TText 替换 $WCMIXED?TText:FText$,否则用 FText 替换。
$WCMODS$若本地存在修改,就用 TText 替换 $WCMODS?TText:FText$,否则用 FText 替换。
$WCUNVER$$WCUNVER?TText:FText$ is replaced with TText if there are unversioned items in the working copy, or FText if not.
$WCEXTALLFIXED$$WCEXTALLFIXED?TText:FText$ is replaced with TText if all externals are fixed to an explicit revision, or FText if not.
$WCISTAGGED$$WCISTAGGED?TText:FText$ is replaced with TText if the repository URL contains the tags classification pattern, or FText if not.
$WCURL$用传递给SubWCRev的工作目录的版本库地址替换。
$WCINSVN$$WCINSVN?TText:FText$ is replaced with TText if the entry is versioned, or FText if not.
$WCNEEDSLOCK$若入口有svn:needs-lock属性设定,就用 TText 替换 $WCNEEDSLOCK?TText:FText$,否则用FText 替换。
$WCISLOCKED$若入口被锁定,就用 TText 替换 $WCISLOCKED?TText:FText$,否则用 FText 替换。
$WCLOCKDATE$, $WCLOCKDATEUTC$Replaced with the lock date. Time formatting can be used as described for $WCDATE$.
$WCLOCKOWNER$用锁定所有者的名字来替换
$WCLOCKCOMMENT$用锁定的备注来替换
$WCUNVER$$WCUNVER?TText:FText$ is replaced with TText if there are unversioned files or folders in the working copy, or FText if not.

SubWCRev does not directly support nesting of expressions, so for example you cannot use an expression like:

  1. #define SVN_REVISION "$WCMIXED?$WCRANGE$:$WCREV$$"

But you can usually work around it by other means, for example:

  1. #define SVN_RANGE $WCRANGE$
  2. #define SVN_REV $WCREV$
  3. #define SVN_REVISION "$WCMIXED?SVN_RANGE:SVN_REV$"

提示

Some of these keywords apply to single files rather than to an entire working copy, so it only makes sense to use these when SubWCRev is called to scan a single file. This applies to $WCINSVN$, $WCNEEDSLOCK$, $WCISLOCKED$, $WCLOCKDATE$, $WCLOCKOWNER$ and $WCLOCKCOMMENT$.