SubWCRev adalah program konsol Windows yang bisa digunakan untuk membaca status dari copy pekerjaan Subversion dan secara opsional melakukan substitusi kata kunci dalam file template. Ini sering dipakai sebagai bagian dari proses pembangunan dalam arti menyertakan informasi copy pekerjaan ke dalam obyek yang sedang Anda bangun. Biasanya mungkin digunakan untuk menyertakan angka revisi dalam kotak “Tentang”.
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
adalah path ke copy pekerjaan yang sedang diperiksa. Anda hanya bisa menggunakan SubWCRev pada copy pekerjaan, bukannya secara langsung pada repositori. Path bisa absolut atau relatif ke direktori pekerjaan saat ini.
Jika Anda ingin SubWCRev untuk melakukan penggantian kata kunci, agar field seperti revisi repositori dan URL disimpan ke file teks, Anda perlu menyediakan file template SrcVersionFile
dan file output DstVersionFile
yang berisi versi pengganti dari 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:
/trunk/doc /trunk/doc/*
Or, assuming the .subwcrevignore
file is in the working copy root which is checked out from trunk, using the patterns
doc doc/*
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. -nm
, not -n -m
.
Tabel 6.1. Daftar saklar baris perintah yang tersedia
Saklar | Deskripsi |
---|---|
-n | If this switch is given, SubWCRev will exit with ERRORLEVEL 7 if the working copy contains local modifications. This may be used to prevent building with uncommitted changes present. |
-N | If this switch is given, SubWCRev will exit with ERRORLEVEL 11 if the working copy contains unversioned items that are not ignored. |
-m | If this switch is given, SubWCRev will exit with ERRORLEVEL 8 if the working copy contains mixed revisions. This may be used to prevent building with a partially updated working copy. |
-d | If this switch is given, SubWCRev will exit with ERRORLEVEL 9 if the destination file already exists. |
-f | Jika saklar ini diberikan, SubWCRev akan menyertakan revisi folder yang terakhir-diubah. Tindakan standar adalah menggunakan hanya file saat mendapatkan angka revisi. |
-e | If this switch is given, SubWCRev will examine directories which are included with svn:externals , but only if they are from the same repository. The default behaviour is to ignore externals. |
-E | If this switch is given, same as -e , but it ignores the externals with explicit revisions, when the revision range inside of them is only the given explicit revision in the properties. So it doesn't lead to mixed revisions. |
-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 .subwcrevignore files and include all files. |
-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:
Tabel 6.2. List of SubWCRev error codes
Error Code | Deskripsi |
---|---|
1 | Syntax error. One or more command line parameters are invalid. |
2 | The file or folder specified on the command line was not found. |
3 | The input file could not be opened, or the target file could not be created. |
4 | Could not allocate memory. This could happen if e.g. the source file is too big. |
5 | The source file can not be scanned properly. |
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 -n switch. |
8 | The working copy has mixed revisions. This requires the -m switch. |
9 | The output file already exists. This requires the -d switch. |
10 | The specified path is not a working copy or part or one. |
11 | The working copy has unversioned files or folders in it. This requires the -N switch. |