UndoCheckOutFiles(Objects: IMetabaseObjectDescriptors, FileNames: Array, Var ResId: Integer): Boolean;
UndoCheckOutFiles(Objects: Prognoz.Platform.Interop.Metabase.IMetabaseObjectDescriptors; FileNames: Array; var ResId: uinteger): boolean;
Objects. The objects, which changes must be undone. Changed objects can be set manually or obtained using the IMetabase.GetPendingChangesVCS method
FileNames. Array of paths to changed object files. Paths to changed object files can be set manually or obtained using the IMetabaseObjectDescriptor.LocalCheckedOutFileNames property.
ResId. The variable, into which an error code is stored.
The UndoCheckOutFiles method undoes changes in the specified objects.
This method can be used if objects are added to version control system and object changes have not been checked in yet.
After the changes were successfully undone, the method returns True and error code is set to 0. If the changes were not undone, the method returns False and the ResId parameter is set to error code.
To check in changes in the specified objects, use the IMetabase.CheckInFiles method.
To execute the example, make sure that the repository is connected to the version control system and it contains the changed object with the OBJECT_VCS identifier. The local repository of version control system contains files of the changed object at C:\GIT\GitRepo\OBJECT_VCS\.
Add a link to the Metabase system assembly.
Sub UserProc;
Var
MB: IMetabase;
Objects: IMetabaseObjectDescriptors;
ObjKeys: Array Of Integer;
FileNames: Array Of String;
ResId: Integer;
Begin
MB := MetabaseClass.Active;
// Set changed object
ObjKeys := New Integer[1];
ObjKeys[0] := MB.GetObjectKeyById("OBJECT_VCS");
Objects := MB.GetItems(ObjKeys);
// Set changed object file
FileNames := New String[1];
FileNames[0] := "C:\GIT\GitRepo\OBJECT_VCS\OBJECT_VCS.text";
// Undo changes
Mb.UndoCheckOutFiles(Objects, FileNames, ResId);
End Sub UserProc;
Imports Prognoz.Platform.Interop.Metabase;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Objects: IMetabaseObjectDescriptors;
ObjKeys: Array Of Integer;
FileNames: Array Of String;
ResId: Uinteger;
Begin
MB := Params.Metabase;
// Set changed object
ObjKeys := New Integer[1];
ObjKeys[0] := MB.GetObjectKeyById("OBJECT_VCS") As Integer;
Objects := MB.GetItems(ObjKeys);
// Set changed object file
FileNames := New String[1];
FileNames[0] := "C:\GIT\GitRepo\OBJECT_VCS\OBJECT_VCS.text";
// Undo changes
MB.UndoCheckOutFiles(Objects, FileNames, Var ResId);
End Sub;
After executing the example, changes in the specified object are undone in the repository and the OBJECT_VCS.text file in the local repository of version control system.
See also: