VcsBeforeCheckIn
function VcsBeforeCheckIn( ProjectID, FolderID, FileID, UserID, ViewID: Cardinal;
|
Path: PChar; const Info: PCheckInInfo;
|
const strError: PChar ): Boolean; stdcall; export;
|
This function is called before a CheckIn action occurs. The parameters define what file is being checked in and where it is being checked in from. You can use this information to validate the Checkin action or, using the Direct API, to modify the action before it occurs. If you want to stop the action occurring, return False from the function, otherwise, return True.
Parameters
Name
|
Description
|
ProjectID
|
ID of the containing Project
|
FolderID
|
ID of the Folder that contains the file
|
FileID
|
ID of the file
|
UserID
|
ID of the user carrying out the action
|
ViewID
|
If a View is applied, the ID of the View
|
Path
|
The location where the file is being checked in from
|
Info
|
A pointer to the TCheckInInfo structure containing information about how the checkin will be handled
|
strError
|
If you return False from this function to cause the action to fail, you can assign a description of the error here.
|
VcsAfterCheckIn
procedure VcsAfterCheckIn( ProjectID, FolderID, FileID, UserID, ViewID, RevisionID: Cardinal;
|
Path: PChar; Result: Integer ); stdcall; export;
|
This procedure is called after a CheckIn action occurs. The parameters define what file that was checked in and where it was checked in from.
Parameters
Name
|
Description
|
ProjectID
|
ID of the containing Project
|
FolderID
|
ID of the Folder that contains the file
|
FileID
|
ID of the file
|
UserID
|
ID of the user that carried out the action
|
ViewID
|
If a View is applied, the ID of the View
|
RevisionID
|
The ID of the newly created revision
|
Path
|
The location where the file was checked in from
|
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 Checkin handler checks for locally stored comments and uses these to replace the main ones for this file:
function VcsBeforeCheckIn( ProjectID, FolderID, FileID, UserID, ViewID: Cardinal; Path: PChar; const Info: PCheckInInfo; const strError: PChar ): Boolean;
|
var
|
Lines: TStrings;
|
begin
|
// Before we check in the files, we want to replace the default comment with the
|
// comment associated with the file. This comment is generate using the TCD5CommentServer
|
// Delphi addin.
|
if FileExists( ChangeFileExt( Path, '.cmt' ) ) then
|
begin
|
Lines := TStringList.Create;
|
try
|
Lines.LoadFromFile( ChangeFileExt( Path, '.cmt' ) );
|
if Lines.Text <> '' then
|
begin
|
// Info.Comments has a max size of 65K by default
|
if Length( Lines.Text ) < 65536 then
|
StrCopy( Info.Comments, PChar( Lines.Text ) );
|
end;
|
// Remove the comment file as we are done with it...
|
DeleteFile( ChangeFileExt( Path, '.cmt' ) )
|
finally
|
Lines.Free;
|
end;
|
end;
|
Result := True;
|
end;
|
|
|
procedure VcsAfterCheckIn( ProjectID, FolderID, FileID, UserID, ViewID, RevisionID: Cardinal; Path: PChar; Result: Integer );
|
begin
|
// Check if a merge took place, and update the server if necessary
|
if FMerged and ( FMergedFrom > 0 ) then
|
VcsSetMergeInfo( FileID, RevisionID, FMergedFrom );
|
// Note that this is a temporary measure, and future releases may have
|
// built-in merge functionality.
|
end;
|
© 1995-2018 MCN Software