SubWCRev is Windows console program which can be used to read the status of a Subversion working copy and optionally perform keyword substitution in a template file. This is often used as part of the build process as a means of incorporating working copy information into the object you are building. Typically it might be used to include the revision number in an “About” box.
SubWCRev reads the Subversion status of all files in a working copy, excluding externals by default. It records the highest commit revision number found, and the commit timestamp of that revision, it also records whether there are local modifications in the working copy, or mixed update revisions. The revision number, update revision range and modification status are displayed on stdout.
SubWCRev.exe is called from the command line or a script, and is controlled using the command line parameters.
SubWCRev WorkingCopyPath [SrcVersionFile DstVersionFile] [-nmdfe]
WorkingCopyPath is the path to the working copy being checked. You can only use SubWCRev on working copies, not directly on the repository. The path may be absolute or relative to the current working directory.
If you want SubWCRev to perform keyword substitution, so that fields like repository revision and URL are saved to a text file, you need to supply a template file
SrcVersionFile and an output file
DstVersionFile which contains the substituted version of the template.
You can specify ignore patterns for SubWCRev to prevent specific files and paths from being considered. The patterns are read from a file named
.subwcrevignore. The file is read from the specified path, and also from the working copy root. If the file does not exist, no files or paths are ignored. The
.subwcrevignore file can contain multiple patterns, separated by newlines. The patterns are matched against the paths relative to the repository root and paths relative to the path of the
.subwcrevignore file. For example, to ignore all files in the
doc folder of the TortoiseSVN working copy, the
.subwcrevignore would contain the following lines:
Or, assuming the
.subwcrevignore file is in the working copy root which is checked out from trunk, using the patterns
is the same as the example above.
To ignore all images, the ignore patterns could be set like this:
*.png *.jpg *.ico *.bmp
The ignore patterns are case-sensitive, just like Subversion is.
To create a file with a starting dot in the Windows explorer, enter
.subwcrevignore.. Note the trailing dot.
There are a number of optional switches which affect the way SubWCRev works. If you use more than one, they must be specified as a single group, e.g.
Tabela 6.1. List of available command line switches
|-n||If this switch is given, SubWCRev will exit with |
|-N||If this switch is given, SubWCRev will exit with |
|-m||If this switch is given, SubWCRev will exit with |
|-d||If this switch is given, SubWCRev will exit with |
|-f||If this switch is given, SubWCRev will include the last-changed revision of folders. The default behaviour is to use only files when getting the revision numbers.|
|-e||If this switch is given, SubWCRev will examine directories which are included with |
|-E||If this switch is given, same as |
|-x||If this switch is given, SubWCRev will output the revision numbers in HEX.|
|-X||If this switch is given, SubWCRev will output the revision numbers in HEX, with '0X' prepended.|
|-F||If this switch is given, SubWCRev will ignore any |
|-q||If this switch is given, SubWCRev will perform the keyword substitution without showing working copy status on stdout.|
If there is no error, SubWCRev returns zero. But in case an error occurs, the error message is written to stderr and shown in the console. And the returned error codes are:
Tabela 6.2. List of SubWCRev error codes
|Código de Erro||Descrição|
|1||Erro de sintaxe. Um ou mais parâmetros de linha de comando são inválidos.|
|2||O arquivo ou pasta especificada na linha de comando não foi encontrado.|
|3||O arquivo de entrada não pôde ser aberto, ou o arquivo de destino não pode ser criado.|
|4||Could not allocate memory. This could happen if e.g. the source file is too big.|
|5||O arquivo fonte não pode ser escaneado apropriadamente.|
|6||SVN error: Subversion returned with an error when SubWCRev tried to find the information from the working copy.|
|7||The working copy has local modifications. This requires the |
|8||The working copy has mixed revisions. This requires the |
|9||The output file already exists. This requires the |
|10||O caminho especificado não é uma cópia de trabalho ou parte de uma.|
|11||The working copy has unversioned files or folders in it. This requires the |