CommitFile()
This commit is contained in:
parent
b6ca18f053
commit
9d590039aa
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
helloworld.exe
BIN
helloworld.exe
Binary file not shown.
78
helloworld.lpi
Normal file
78
helloworld.lpi
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<CONFIG>
|
||||||
|
<ProjectOptions>
|
||||||
|
<Version Value="12"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<General>
|
||||||
|
<Flags>
|
||||||
|
<MainUnitHasCreateFormStatements Value="False"/>
|
||||||
|
<MainUnitHasTitleStatement Value="False"/>
|
||||||
|
<MainUnitHasScaledStatement Value="False"/>
|
||||||
|
</Flags>
|
||||||
|
<SessionStorage Value="InProjectDir"/>
|
||||||
|
<Title Value="helloworld"/>
|
||||||
|
<UseAppBundle Value="False"/>
|
||||||
|
<ResourceType Value="res"/>
|
||||||
|
</General>
|
||||||
|
<BuildModes>
|
||||||
|
<Item Name="Default" Default="True"/>
|
||||||
|
</BuildModes>
|
||||||
|
<PublishOptions>
|
||||||
|
<Version Value="2"/>
|
||||||
|
<UseFileFilters Value="True"/>
|
||||||
|
</PublishOptions>
|
||||||
|
<RunParams>
|
||||||
|
<FormatVersion Value="2"/>
|
||||||
|
</RunParams>
|
||||||
|
<RequiredPackages>
|
||||||
|
<Item>
|
||||||
|
<PackageName Value="LazUtils"/>
|
||||||
|
</Item>
|
||||||
|
</RequiredPackages>
|
||||||
|
<Units>
|
||||||
|
<Unit>
|
||||||
|
<Filename Value="helloworld.lpr"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit>
|
||||||
|
<Filename Value="unit1.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="Unit1"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit>
|
||||||
|
<Filename Value="tariffcalculator.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="TariffCalculator"/>
|
||||||
|
</Unit>
|
||||||
|
</Units>
|
||||||
|
</ProjectOptions>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<Target>
|
||||||
|
<Filename Value="helloworld"/>
|
||||||
|
</Target>
|
||||||
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||||
|
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Linking>
|
||||||
|
<Debugging>
|
||||||
|
<DebugInfoType Value="dsDwarf3"/>
|
||||||
|
</Debugging>
|
||||||
|
</Linking>
|
||||||
|
</CompilerOptions>
|
||||||
|
<Debugging>
|
||||||
|
<Exceptions>
|
||||||
|
<Item>
|
||||||
|
<Name Value="EAbort"/>
|
||||||
|
</Item>
|
||||||
|
<Item>
|
||||||
|
<Name Value="ECodetoolError"/>
|
||||||
|
</Item>
|
||||||
|
<Item>
|
||||||
|
<Name Value="EFOpenError"/>
|
||||||
|
</Item>
|
||||||
|
</Exceptions>
|
||||||
|
</Debugging>
|
||||||
|
</CONFIG>
|
@ -6,29 +6,44 @@ program helloworld(output);
|
|||||||
|
|
||||||
|
|
||||||
uses
|
uses
|
||||||
TariffCalculator, CTypes;
|
TariffCalculator, CTypes, LazUtils, LazFileUtils, LazUtf8;
|
||||||
|
|
||||||
var
|
var
|
||||||
TariffCalc: TariffCalculatorHandle;
|
//TariffCalc: TariffCalculatorHandle;
|
||||||
CustomerRepo: array[0..100] of char;
|
CustomerRepo: array[0..100] of char;
|
||||||
LocalCustomerRepo: array[0..100] of char;
|
LocalCustomerRepo: array[0..100] of char;
|
||||||
|
LocalBranchName: array[0..32] of char;
|
||||||
|
FileToCommit: array[0..128] of char;
|
||||||
|
CommitMessage: array[0..256] of char;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
writeLn('Hello, World!') ;
|
|
||||||
// TariffCalc := NewTariffCalculator;
|
// TariffCalc := NewTariffCalculator;
|
||||||
// DeleteTariffCalculator(TariffCalc);
|
// DeleteTariffCalculator(TariffCalc);
|
||||||
if InitGitLibrary() > 0 then
|
|
||||||
begin
|
|
||||||
writeLn('init OK!') ;
|
|
||||||
CustomerRepo := 'https://git.mimbach49.de/GerhardHoffmann/customer_999.git';
|
|
||||||
LocalCustomerRepo := 'C:\\tmp\\customer_999';
|
|
||||||
CloneRepository(CustomerRepo, LocalCustomerRepo);
|
|
||||||
|
|
||||||
ShutdownGitLibrary();
|
CustomerRepo := 'https://git.mimbach49.de/GerhardHoffmann/customer_999.git';
|
||||||
|
LocalCustomerRepo := 'C:\\tmp\\customer_999';
|
||||||
|
LocalBranchName := 'zg1/zone1';
|
||||||
|
FileToCommit := 'etc/psa_tariff/tariff01.json';
|
||||||
|
CommitMessage := 'TEST TEST';
|
||||||
|
if not DirectoryExistsUTF8(ExpandFilenameUtf8(LocalCustomerRepo)) then
|
||||||
|
CreateDirUTF8(ExpandFilenameUtf8(LocalCustomerRepo));
|
||||||
|
|
||||||
|
if InitGitLibrary() > 0 then
|
||||||
|
Try
|
||||||
|
writeLn('initialized git library') ;
|
||||||
|
if not DirectoryExistsUTF8(ExpandFilenameUtf8(LocalCustomerRepo+'\\.git')) then
|
||||||
|
CloneRepository(CustomerRepo, LocalCustomerRepo);
|
||||||
|
if not CheckoutLocalBranch(LocalCustomerRepo, LocalBranchName) = 0 then
|
||||||
|
writeLn('cannot check out') ;
|
||||||
|
if not CommitFile(LocalCustomerRepo, LocalBranchName, FileToCommit, CommitMessage) = 0 then
|
||||||
|
writeLn('cannot check out') ;
|
||||||
|
Finally
|
||||||
|
if ShutdownGitLibrary() >= 0 then
|
||||||
|
writeLn('shutdown git library') ;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
writeLn('init NOT OK!') ;
|
writeLn('initializing git library FAILED') ;
|
||||||
Readln;
|
Readln;
|
||||||
end;
|
end;
|
||||||
end.
|
end.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
unit TariffCalculator;
|
unit TariffCalculator;
|
||||||
|
|
||||||
{$mode ObjFPC}{$H-}
|
{$mode ObjFPC}{$H+}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
@ -18,6 +18,9 @@ procedure DeleteTariffCalculator(handle: TariffCalculatorHandle); stdcall;
|
|||||||
function InitGitLibrary: cint32; stdcall;
|
function InitGitLibrary: cint32; stdcall;
|
||||||
function ShutdownGitLibrary: cint32; stdcall;
|
function ShutdownGitLibrary: cint32; stdcall;
|
||||||
function CloneRepository(var url; var local_path) : cint32; stdcall;
|
function CloneRepository(var url; var local_path) : cint32; stdcall;
|
||||||
|
function CheckoutLocalBranch(var local_path; var branch_name) : cint32; stdcall;
|
||||||
|
function CommitFile(var local_path; var branch_name;
|
||||||
|
var file_name; var comment) : cint32; stdcall;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -30,6 +33,9 @@ procedure DeleteTariffCalculator(handle: TariffCalculatorHandle); stdcall; exter
|
|||||||
function InitGitLibrary: cint32; stdcall; external DLLName;
|
function InitGitLibrary: cint32; stdcall; external DLLName;
|
||||||
function ShutdownGitLibrary: cint32; stdcall; external DLLName;
|
function ShutdownGitLibrary: cint32; stdcall; external DLLName;
|
||||||
function CloneRepository(var url; var local_path) : cint32; stdcall; external DLLName;
|
function CloneRepository(var url; var local_path) : cint32; stdcall; external DLLName;
|
||||||
|
function CheckoutLocalBranch(var local_path; var branch_name) : cint32; stdcall; external DLLName;
|
||||||
|
function CommitFile(var local_path; var branch_name;
|
||||||
|
var file_name; var comment) : cint32; stdcall; external DLLName;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user