COM interface

If you need to access Subversion revision information from other programs, you can use the COM interface of SubWCRev. The object to create is SubWCRev.object, and the following methods are supported:

表 6.3. COM/automation methods supported

Method描述
.GetWCInfoThis method traverses the working copy gathering the revision information. Naturally you must call this before you can access the information using the remaining methods. The first parameter is the path. The second parameter should be true if you want to include folder revisions. Equivalent to the -f command line switch. The third parameter should be true if you want to include svn:externals. Equivalent to the -e command line switch.
.RevisionThe highest commit revision in the working copy. Equivalent to $WCREV$
.DateThe commit date/time of the highest commit revision. Equivalent to $WCDATE$
.AuthorThe author of the highest commit revision, that is, the last person to commit changes to the working copy.
.MinRevThe minimum update revision, as shown in $WCRANGE$
.MaxRevThe maximum update revision, as shown in $WCRANGE$
.HasModificationsTrue if there are local modifications
.UrlReplaced with the repository URL of the working copy path used in GetWCInfo. Equivalent to $WCURL$


The following example shows how the interface might be used.

// testCOM.js - javascript file
// test script for the SubWCRev COM/Automation-object

filesystem = new ActiveXObject("Scripting.FileSystemObject");

SubWCRev1 = new ActiveXObject("SubWCRev.object");
SubWCRev2 = new ActiveXObject("SubWCRev.object");
SubWCRev3 = new ActiveXObject("SubWCRev.object");

SubWCRev1.GetWCInfo(filesystem.GetAbsolutePathName("."), 0, 0);
SubWCRev2.GetWCInfo(filesystem.GetAbsolutePathName(".."), 1, 1);
SubWCRev3.GetWCInfo(filesystem.GetAbsolutePathName("SubWCRev.cpp"), 0, 0);

sInfo1 = "Revision = " + SubWCRev1.Revision + 
         "\nMin Revision = " + SubWCRev1.MinRev +
         "\nMax Revision = " + SubWCRev1.MaxRev +
         "\nDate = " + SubWCRev1.Date +
         "\nURL = " + SubWCRev1.Url +
         "\nAuthor = " + SubWCRev1.Author +
         "\nHasMods = " + SubWCRev1.HasModifications;
sInfo2 = "Revision = " + SubWCRev2.Revision +
         "\nMin Revision = " + SubWCRev2.MinRev +
         "\nMax Revision = " + SubWCRev2.MaxRev +
         "\nDate = " + SubWCRev2.Date +
         "\nURL = " + SubWCRev2.Url +
         "\nAuthor = " + SubWCRev2.Author +
         "\nHasMods = " + SubWCRev2.HasModifications;
sInfo3 = "Revision = " + SubWCRev3.Revision +
         "\nMin Revision = " + SubWCRev3.MinRev +
         "\nMax Revision = " + SubWCRev3.MaxRev +
         "\nDate = " + SubWCRev3.Date +
         "\nURL = " + SubWCRev3.Url +
         "\nAuthor = " + SubWCRev3.Author +
         "\nHasMods = " + SubWCRev3.HasModifications;

WScript.Echo(sInfo1);
WScript.Echo(sInfo2);
WScript.Echo(sInfo3);