Promote
Return to Introduction  Previous page  Next page
If these methods are exported from the DLL, they will be called before and after a Promote event.

VcsBeforePromote

function VcsBeforePromote( FileID, RevisionID, PromotionID, UserID, ViewID: Cardinal;   
                           Path, Revision, PromoteTo: PChar; const strError: PChar ): Boolean; stdcall; export;  

This function is called before a Promote action occurs. The parameters define what file is being Promoted and which level it is being promoted to. You can use this information to validate the Promote 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 promoted
RevisionID
The ID of the revision being promoted
PromotionID
The ID of the level the file is being promoted to.
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
Revision
The name of the revision being promoted
PromoteTo
The name of the level the file is being promoted to
strError
If you return False from this function to cause the action to fail, you can assign a description of the error here.



VcsAfterPromote

procedure VcsAfterPromote( FileID, RevisionID, PromotionID, UserID, ViewID: Cardinal;   
                           Path, Revision, PromoteTo: PChar; Result: Integer ); stdcall; export;  

This procedure is called after a Promote action occurs.

Parameters

Name
Description
FileID
ID of the file that was promoted
RevisionID
The ID of the revision that was promoted
PromotionID
The ID of the level the file was promoted to.
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
Revision
The name of the revision that was promoted
PromoteTo
The name of the level the file was promoted to
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 Promote handler simply logs the action:

function VcsBeforePromote( FileID, RevisionID, PromotionID, UserID, ViewID: Cardinal; Path, Revision, PromoteTo: PChar; const strError: PChar ): Boolean;  
begin  
  LogIt( Format( '---> Promoting revision %s of %s to %s', [ String( Revision ), ExtractFileName( String( Path ) ), String( PromoteTo ) ] ) );  
  Result := True;  
end;  
 
 
The following method is called after a Promote action and simply logs the result:

procedure VcsAfterPromote( FileID, RevisionID, PromotionID, UserID, ViewID: Cardinal; Path, Revision, PromoteTo: PChar; Result: Integer );  
begin  
  if Result = Err_OK then  
    LogIt( Format( '<--- Promoted revision %s of %s to %s', [ String( Revision ), ExtractFileName( String( Path ) ), String( PromoteTo ) ] ) )  
  else  
    LogIt( Format( '<--- Error (%d) promoting revision %s of %s to %s', [ Result, String( Revision ), ExtractFileName( String( Path ) ), String( PromoteTo ) ] ) );  
end;  



 


© 1995-2018 MCN Software