VcsBeforeLock
| function VcsBeforeLock( FileID, RevisionID, UserID, ViewID: Cardinal;
|
| Path: PChar; const LockComments, LockExtra: PChar;
|
| Lock, Forced: Boolean; const strError: PChar ): Boolean; stdcall; export;
|
This function is called before a Lock or Unlock action occurs. The parameters define what file is being checked out and where it is being checked out to. You can use this information to validate the Lock/Unlock action or, using the Direct API, to modify the action before it occurs. If you want to stop the action occuring, return False from the function, otherwise, return True.
Parameters
|
Name
|
Description
|
|
FileID
|
ID of the file being locked/unlocked
|
|
RevisionID
|
The RevisionID of the revision being locked. 0 if it is the tip revision
|
|
UserID
|
ID of the user carrying out the action
|
|
ViewID
|
If a View is applied, the ID of the View
|
|
Path
|
The path to the local copy of the file
|
|
LockComments
|
The comments being applied to this lock. You can modify this field
|
|
LockExtra
|
Currently for internal use only.
|
|
Lock
|
Whether the file is being Locked or Unlocked
|
|
Forced
|
If the file is being unlocked, whether an Admin user is forcing an unlock
|
|
strError
|
If you return False from this function to cause the action to fail, you can assign a description of the error here.
|
VcsAfterLock
| procedure VcsAfterLock( FileID, RevisionID, UserID, ViewID: Cardinal;
|
| Path: PChar; Lock: Boolean; Result: Integer ); stdcall; export;
|
This procedure is called after a Lock or Unlock action occurs.
Parameters
|
Name
|
Description
|
|
FileID
|
ID of the file
|
|
RevisionID
|
The RevisionID of the revision being locked. 0 if it is the tip revision
|
|
UserID
|
ID of the user that carried out the action
|
|
ViewID
|
If a View is applied, the ID of the View
|
|
Path
|
The location of the local file
|
|
Lock
|
If Lock is True, this was a Lock action, otherwise it was an Unlock.
|
|
Result
|
The result code for the action. If the action was successful, Result will be Err_OK otherwise it will be one of the standard error codes defined in TCVcsConst.pas
|
Example (Delphi)
The following Before Lock handler simply adds a comment to the lock if there are no comments defined:
| function VcsBeforeLock( FileID, RevisionID, UserID, ViewID: Cardinal; Path: PChar; const LockComments, LockExtra: PChar; Lock, Forced: Boolean; const strError: PChar ): Boolean;
|
| begin
|
| if LockComments[ 0 ] = #0 then
|
| begin
|
| if Lock then
|
| StrCopy( LockComments, 'The file is being locked' )
|
| else
|
| StrCopy( LockComments, 'The file is being unlocked' );
|
| end;
|
| Result := True;
|
| end;
|
|
|
|
|
| procedure VcsAfterLock( FileID, RevisionID, UserID, ViewID: Cardinal; Path: PChar; Lock: Boolean; Result: Integer );
|
| begin
|
| if ( Result = Err_OK ) then
|
| begin
|
| // By default, Lock and Unlock may not update the status of the local file. Do it here...
|
| if Lock then
|
| FileSetAttr( String( Path ), FileGetAttr( String( Path ) ) or faReadOnly )
|
| else
|
| FileSetAttr( String( Path ), FileGetAttr( String( Path ) ) and not faReadOnly );
|
| end;
|
| end;
|
© 1995-2011 Quality Software Components Ltd