Bab 6. Program SubWCRev

Daftar Isi

Baris Perintah SubWCRev
Penggantian Kata Kunci
Contoh Kata Kunci
COM interface

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.

Baris Perintah SubWCRev

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:


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:



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

-nIf 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.
-NIf this switch is given, SubWCRev will exit with ERRORLEVEL 11 if the working copy contains unversioned items that are not ignored.
-mIf 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.
-dIf this switch is given, SubWCRev will exit with ERRORLEVEL 9 if the destination file already exists.
-fJika saklar ini diberikan, SubWCRev akan menyertakan revisi folder yang terakhir-diubah. Tindakan standar adalah menggunakan hanya file saat mendapatkan angka revisi.
-eIf 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.
-EIf 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.
-xIf this switch is given, SubWCRev will output the revision numbers in HEX.
-XIf this switch is given, SubWCRev will output the revision numbers in HEX, with '0X' prepended.
-FIf this switch is given, SubWCRev will ignore any .subwcrevignore files and include all files.
-qIf 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 CodeDeskripsi
1Syntax error. One or more command line parameters are invalid.
2The file or folder specified on the command line was not found.
3The input file could not be opened, or the target file could not be created.
4Could not allocate memory. This could happen if e.g. the source file is too big.
5The source file can not be scanned properly.
6SVN error: Subversion returned with an error when SubWCRev tried to find the information from the working copy.
7The working copy has local modifications. This requires the -n switch.
8The working copy has mixed revisions. This requires the -m switch.
9The output file already exists. This requires the -d switch.
10The specified path is not a working copy or part or one.
11The working copy has unversioned files or folders in it. This requires the -N switch.

TortoiseSVN homepage