source upload

This commit is contained in:
Razor12911
2022-01-17 22:16:47 +02:00
parent 12936d065b
commit 098e8c48de
1778 changed files with 1206749 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
del *.bak /s> nul
fossil ci -M %1
rem push if chkFossilPush checked in SourceCodeRep tool
if %2==1 (
fossil push
)
@echo.
@pause

View File

@@ -0,0 +1,15 @@
#!/bin/bash
echo DescFile=$1
echo Push=$2
echo FossilRepository=$3
cd $3
fossil ci -M $1
# push if chkFossilPush checked in SourceCodeRep tool
if [ $2 -eq 1 ]
then
fossil push
fi

View File

@@ -0,0 +1 @@
fossil status>%1

View File

@@ -0,0 +1,3 @@
#!/bin/bash
fossil status > $1

View File

@@ -0,0 +1,5 @@
fossil pull
fossil update
@echo.
@pause

View File

@@ -0,0 +1,4 @@
#!/bin/bash
fossil pull
fossil update

View File

@@ -0,0 +1,22 @@
@echo off
@echo FossilRepository=%1
@echo GitRepository=%2
@echo GitExe=%3
@echo DescFile=%4
@echo DevPath=%5
@echo.
@echo.
@echo mORMot repository
@echo -----------------
rem %3 pull
del /q /s %2\*.bak %2\*.bk2 > nul 2> nul
%3 add .
%3 commit -a --file=%4
%3 push
echo.
pause

View File

@@ -0,0 +1,17 @@
#!/bin/bash
echo FossilRepository=$1
echo GitRepository=$2
echo GitExe=$3
echo DescFile=$4
echo DevPath=$5
echo
echo
echo mORMot repository
echo -----------------
cd $2
$3 add .
$3 commit -a --file=$4
$3 push

View File

@@ -0,0 +1,60 @@
@echo off
@echo FossilRepository=%1
@echo GitRepository=%2
@echo GitExe=%3
@echo DescFile=%4
@echo DevPath=%5
@echo.
@echo.
@echo mORMot repository
@echo -----------------
del /q /s %2\*.bak %2\*.bk2 > nul 2> nul
%3 add .
%3 commit -a --file=%4
%3 push
@echo.
@echo.
@echo SynPDF repository
@echo -----------------
@cd ..\SynPDF
%3 add .
%3 commit -a --file=%4
%3 push
@echo.
@echo.
@echo dmustache repository
@echo --------------------
@cd ..\dmustache
%3 add .
%3 commit -a --file=%4
%3 push
@echo.
@echo.
@echo LVCL repository
@echo ---------------
@cd ..\LVCL
%3 add .
%3 commit -a --file=%4
%3 push
@echo.
@echo.
@echo SynProject repository
@echo ---------------------
@cd ..\SynProject
%3 add .
%3 commit -a --file=%4
%3 push
@echo.
@pause

View File

@@ -0,0 +1,7 @@
#!/bin/bash
GitCommit.sh
GitCommitDMustache.sh
GitCommitLVCL.sh
GitCommitSynPdf.sh
GitCommitSynProject.sh

View File

@@ -0,0 +1,19 @@
@echo off
@echo FossilRepository=%1
@echo GitRepository=%2
@echo GitExe=%3
@echo DescFile=%4
@echo.
@echo.
@echo dmustache repository
@echo --------------------
@cd ..\dmustache
%3 add .
%3 commit -a --file=%4
%3 push
@echo.
@pause

View File

@@ -0,0 +1,18 @@
#!/bin/bash
echo FossilRepository=$1
echo GitRepository=$2
echo GitExe=$3
echo DescFile=$4
#echo DevPath=$5
echo
echo
echo dmustache repository
echo --------------------
cd $2
cd ../dmustache
$3 add .
$3 commit -a --file=$4
$3 push

View File

@@ -0,0 +1,18 @@
@echo off
@echo FossilRepository=%1
@echo GitRepository=%2
@echo GitExe=%3
@echo DescFile=%4
@echo.
@echo.
@echo LVCL repository
@echo ---------------
@cd ..\LVCL
%3 add .
%3 commit -a --file=%4
%3 push
@echo.
@pause

View File

@@ -0,0 +1,18 @@
#!/bin/bash
echo FossilRepository=$1
echo GitRepository=$2
echo GitExe=$3
echo DescFile=$4
#echo DevPath=$5
echo
echo
echo LVCL repository
echo ---------------
cd $2
cd ../LVCL
$3 add .
$3 commit -a --file=$4
$3 push

View File

@@ -0,0 +1,16 @@
@echo off
@echo FossilRepository=%1
@echo GitRepository=%2
@echo GitExe=%3
@echo DescFile=%4
@echo.
@echo.
@echo SynPDF repository
@echo -----------------
@cd ..\SynPDF
%3 add .
%3 commit -a --file=%4
%3 push

View File

@@ -0,0 +1,18 @@
#!/bin/bash
echo FossilRepository=$1
echo GitRepository=$2
echo GitExe=$3
echo DescFile=$4
#echo DevPath=$5
echo
echo
echo SynPDF repository
echo -----------------
cd $2
cd ../SynPDF
$3 add .
$3 commit -a --file=$4
$3 push

View File

@@ -0,0 +1,19 @@
@echo off
@echo FossilRepository=%1
@echo GitRepository=%2
@echo GitExe=%3
@echo DescFile=%4
@echo.
@echo.
@echo SynProject repository
@echo ---------------------
@cd ..\SynProject
%3 add .
%3 commit -a --file=%4
%3 push
@echo.
@pause

View File

@@ -0,0 +1,17 @@
#!/bin/bash
echo FossilRepository=$1
echo GitRepository=$2
echo GitExe=$3
echo DescFile=$4
#echo DevPath=$5
echo
echo
echo SynProject repository
echo ---------------------
cd $2
cd ../SynProject
$3 commit -a --file=$4
$3 push

View File

@@ -0,0 +1,6 @@
@echo GitPath=%1
@echo.
@set path=%1;%path%
@cmd

View File

@@ -0,0 +1,23 @@
program SourceCodeRep;
{$ifndef MSWINDOWS}
{$AppType console}
{$endif}
{$I ../../../Synopse.inc}
uses
{$I ../../../SynDprUses.inc} // includes FastMM4
{$ifdef FPC}
Interfaces, // set appropriate LCL CreateWidgetset()
{$endif FPC}
Forms,
SourceCodeRepMain in 'SourceCodeRepMain.pas' {MainForm};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end.

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@@ -0,0 +1,145 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<General>
<Flags>
<MainUnitHasUsesSectionForAllUnits Value="False"/>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
<MainUnitHasScaledStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="SourceCodeRep"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<BuildModes Count="3">
<Item1 Name="Default" Default="True"/>
<Item2 Name="linux64">
<CompilerOptions>
<Version Value="11"/>
<SearchPaths>
<IncludeFiles Value="../..;../../.."/>
<OtherUnitFiles Value="../..;../../.."/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<SyntaxMode Value="Delphi"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<TargetCPU Value="x86_64"/>
<TargetOS Value="linux"/>
<Optimizations>
<OptimizationLevel Value="2"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
</Item2>
<Item3 Name="win32">
<CompilerOptions>
<Version Value="11"/>
<SearchPaths>
<IncludeFiles Value="../..;../../.."/>
<Libraries Value="../../../static/$(TargetCPU)-$(TargetOS)"/>
<OtherUnitFiles Value="../..;../../.."/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<SyntaxMode Value="Delphi"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<TargetCPU Value="i386"/>
<TargetOS Value="win32"/>
<Optimizations>
<OptimizationLevel Value="2"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
</Item3>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0"/>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="SourceCodeRep.dpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="SourceCodeRepMain.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="MainForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<SearchPaths>
<IncludeFiles Value="../..;../../.."/>
<OtherUnitFiles Value="../..;../../.."/>
<UnitOutputDirectory Value="lib/default"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<SyntaxMode Value="Delphi"/>
</SyntaxOptions>
</Parsing>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,249 @@
object MainForm: TMainForm
Left = 506
Top = 235
BorderStyle = bsDialog
Caption = ' mORMot Source Code Repository Synch'
ClientHeight = 507
ClientWidth = 601
Color = clBtnFace
Constraints.MinHeight = 422
Constraints.MinWidth = 617
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
DesignSize = (
601
507)
PixelsPerInch = 96
TextHeight = 13
object lbl1: TLabel
Left = 24
Top = 8
Width = 66
Height = 13
Caption = 'Pending Files:'
end
object lbl2: TLabel
Left = 24
Top = 224
Width = 95
Height = 13
Caption = 'Commit Description:'
end
object mmoStatus: TMemo
Left = 16
Top = 24
Width = 569
Height = 193
Anchors = [akLeft, akTop, akRight]
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Consolas'
Font.Style = []
ParentFont = False
ReadOnly = True
ScrollBars = ssVertical
TabOrder = 1
end
object mmoDescription: TMemo
Left = 16
Top = 240
Width = 569
Height = 180
Anchors = [akLeft, akTop, akRight, akBottom]
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Consolas'
Font.Style = []
ParentFont = False
ScrollBars = ssVertical
TabOrder = 0
end
object btnFossilSynch: TButton
Left = 168
Top = 427
Width = 113
Height = 32
Anchors = [akLeft, akBottom]
Caption = 'Fossil Synch'
TabOrder = 3
OnClick = btnFossilSynchClick
end
object btnFullSynch: TButton
Left = 472
Top = 427
Width = 113
Height = 57
Anchors = [akLeft, akBottom]
Caption = 'Fossil and Git Synch'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 2
WordWrap = True
OnClick = btnFullSynchClick
end
object btnGitSynch: TButton
Left = 304
Top = 427
Width = 81
Height = 41
Anchors = [akLeft, akBottom]
Caption = 'Git Synch'
TabOrder = 4
OnClick = btnGitSynchClick
end
object btnRefreshStatus: TButton
Left = 520
Top = 5
Width = 75
Height = 18
Anchors = [akTop, akRight]
Caption = 'Refresh'
TabOrder = 5
OnClick = btnRefreshStatusClick
end
object btnGitShell: TButton
Left = 232
Top = 478
Width = 49
Height = 25
Anchors = [akLeft, akBottom]
Caption = 'Git Shell'
TabOrder = 6
OnClick = btnGitShellClick
end
object btnFossilShell: TButton
Left = 168
Top = 478
Width = 65
Height = 25
Anchors = [akLeft, akBottom]
Caption = 'Fossil Shell'
TabOrder = 7
OnClick = btnFossilShellClick
end
object btnTests: TButton
Left = 16
Top = 427
Width = 113
Height = 60
Anchors = [akLeft, akBottom]
Caption = 'Regression Tests'
TabOrder = 8
WordWrap = True
OnClick = btnTestsClick
end
object btnCopyLink: TButton
Left = 512
Top = 222
Width = 75
Height = 18
Caption = 'Copy Link'
TabOrder = 9
OnClick = btnCopyLinkClick
end
object btnGitAll: TButton
Left = 304
Top = 474
Width = 41
Height = 25
Hint =
'Git Commit mORMot + SynPDF + SynMustache + LVCL + SynProject rep' +
'ositories'
Anchors = [akLeft, akBottom]
Caption = 'Git ALL'
ParentShowHint = False
ShowHint = True
TabOrder = 10
OnClick = btnGitSynchClick
end
object btnSynProject: TButton
Left = 392
Top = 426
Width = 65
Height = 25
Hint = 'Git Commit SynProject Repository'
Anchors = [akLeft, akBottom]
Caption = 'SynProject'
ParentShowHint = False
ShowHint = True
TabOrder = 11
OnClick = btnGitSynchClick
end
object btnSynPdf: TButton
Left = 392
Top = 450
Width = 65
Height = 25
Hint = 'Git Commit SynPdf Repository'
Anchors = [akLeft, akBottom]
Caption = 'SynPdf'
ParentShowHint = False
ShowHint = True
TabOrder = 12
OnClick = btnGitSynchClick
end
object btnDMustache: TButton
Left = 392
Top = 474
Width = 65
Height = 25
Hint = 'Git Commit dmustache Repository'
Anchors = [akLeft, akBottom]
Caption = 'dmustache'
ParentShowHint = False
ShowHint = True
TabOrder = 13
OnClick = btnGitSynchClick
end
object btnLVCL: TButton
Left = 344
Top = 474
Width = 41
Height = 25
Hint = 'Git Commit LVCL Repository'
Anchors = [akLeft, akBottom]
Caption = 'LVCL'
ParentShowHint = False
ShowHint = True
TabOrder = 14
OnClick = btnGitSynchClick
end
object chkCopyLink: TCheckBox
Left = 496
Top = 486
Width = 89
Height = 17
Anchors = [akLeft, akBottom]
Caption = 'and copy link'
TabOrder = 15
end
object chkFossilPush: TCheckBox
Left = 168
Top = 458
Width = 65
Height = 17
Anchors = [akLeft, akBottom]
Caption = 'and push'
TabOrder = 16
end
object chkFossilPull: TCheckBox
Left = 230
Top = 458
Width = 59
Height = 17
Anchors = [akLeft, akBottom]
Caption = 'and pull'
TabOrder = 17
end
end

View File

@@ -0,0 +1,237 @@
object MainForm: TMainForm
Left = 506
Height = 507
Top = 235
Width = 617
BorderStyle = bsDialog
Caption = ' mORMot Source Code Repository Synch'
ClientHeight = 507
ClientWidth = 617
Color = clBtnFace
Constraints.MinHeight = 422
Constraints.MinWidth = 617
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
OnCreate = FormCreate
LCLVersion = '1.9.0.0'
object lbl1: TLabel
Left = 24
Height = 14
Top = 8
Width = 77
Caption = 'Pending Files:'
ParentColor = False
end
object lbl2: TLabel
Left = 24
Height = 14
Top = 224
Width = 115
Caption = 'Commit Description:'
ParentColor = False
end
object mmoStatus: TMemo
Left = 16
Height = 193
Top = 24
Width = 585
Anchors = [akTop, akLeft, akRight]
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Consolas'
ParentFont = False
ReadOnly = True
ScrollBars = ssVertical
TabOrder = 1
end
object mmoDescription: TMemo
Left = 16
Height = 180
Top = 240
Width = 585
Anchors = [akTop, akLeft, akRight, akBottom]
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Consolas'
ParentFont = False
ScrollBars = ssVertical
TabOrder = 0
end
object btnFossilSynch: TButton
Left = 168
Height = 32
Top = 427
Width = 113
Anchors = [akLeft, akBottom]
Caption = 'Fossil Synch'
OnClick = btnFossilSynchClick
TabOrder = 3
end
object btnFullSynch: TButton
Left = 472
Height = 57
Top = 427
Width = 113
Anchors = [akLeft, akBottom]
Caption = 'Fossil+Git'
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = [fsBold]
OnClick = btnFullSynchClick
ParentFont = False
TabOrder = 2
end
object btnGitSynch: TButton
Left = 304
Height = 41
Top = 427
Width = 81
Anchors = [akLeft, akBottom]
Caption = 'Git Synch'
OnClick = btnGitSynchClick
TabOrder = 4
end
object btnRefreshStatus: TButton
Left = 536
Height = 18
Top = 5
Width = 75
Anchors = [akTop, akRight]
Caption = 'Refresh'
OnClick = btnRefreshStatusClick
TabOrder = 5
end
object btnGitShell: TButton
Left = 232
Height = 25
Top = 478
Width = 49
Anchors = [akLeft, akBottom]
Caption = 'Git Shell'
OnClick = btnGitShellClick
TabOrder = 6
end
object btnFossilShell: TButton
Left = 168
Height = 25
Top = 478
Width = 65
Anchors = [akLeft, akBottom]
Caption = 'Fossil Shell'
OnClick = btnFossilShellClick
TabOrder = 7
end
object btnTests: TButton
Left = 16
Height = 60
Top = 427
Width = 113
Anchors = [akLeft, akBottom]
Caption = 'Regression Tests'
OnClick = btnTestsClick
TabOrder = 8
end
object btnCopyLink: TButton
Left = 512
Height = 18
Top = 222
Width = 75
Caption = 'Copy Link'
OnClick = btnCopyLinkClick
TabOrder = 9
end
object btnGitAll: TButton
Left = 304
Height = 25
Hint = 'Git Commit mORMot + SynPDF + SynMustache + LVCL + SynProject repositories'
Top = 474
Width = 41
Anchors = [akLeft, akBottom]
Caption = 'Git ALL'
OnClick = btnGitSynchClick
ParentShowHint = False
ShowHint = True
TabOrder = 10
end
object btnSynProject: TButton
Left = 392
Height = 25
Hint = 'Git Commit SynProject Repository'
Top = 426
Width = 65
Anchors = [akLeft, akBottom]
Caption = 'SynProject'
OnClick = btnGitSynchClick
ParentShowHint = False
ShowHint = True
TabOrder = 11
end
object btnSynPdf: TButton
Left = 392
Height = 25
Hint = 'Git Commit SynPdf Repository'
Top = 450
Width = 65
Anchors = [akLeft, akBottom]
Caption = 'SynPdf'
OnClick = btnGitSynchClick
ParentShowHint = False
ShowHint = True
TabOrder = 12
end
object btnDMustache: TButton
Left = 392
Height = 25
Hint = 'Git Commit dmustache Repository'
Top = 474
Width = 65
Anchors = [akLeft, akBottom]
Caption = 'dmustache'
OnClick = btnGitSynchClick
ParentShowHint = False
ShowHint = True
TabOrder = 13
end
object btnLVCL: TButton
Left = 344
Height = 25
Hint = 'Git Commit LVCL Repository'
Top = 474
Width = 41
Anchors = [akLeft, akBottom]
Caption = 'LVCL'
OnClick = btnGitSynchClick
ParentShowHint = False
ShowHint = True
TabOrder = 14
end
object chkCopyLink: TCheckBox
Left = 480
Height = 23
Top = 480
Width = 93
Anchors = [akLeft, akBottom]
Caption = '+copy link'
TabOrder = 15
end
object chkFossilPush: TCheckBox
Left = 168
Height = 23
Top = 455
Width = 66
Anchors = [akLeft, akBottom]
Caption = '+push'
TabOrder = 16
end
object chkFossilPull: TCheckBox
Left = 230
Height = 23
Top = 455
Width = 59
Anchors = [akLeft, akBottom]
Caption = '+pull'
TabOrder = 17
end
end

View File

@@ -0,0 +1,371 @@
unit SourceCodeRepMain;
{$I ../../../Synopse.inc}
interface
uses
{$IFNDEF FPC}
Windows,
{$ELSE}
LCLIntf,
LCLType,
LMessages,
{$ENDIF}
SynCommons,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls,
Clipbrd;
const
VERSION = '1.18';
type
{ TMainForm }
TMainForm = class(TForm)
mmoStatus: TMemo;
lbl1: TLabel;
lbl2: TLabel;
mmoDescription: TMemo;
btnFossilSynch: TButton;
btnFullSynch: TButton;
btnGitSynch: TButton;
btnRefreshStatus: TButton;
btnGitShell: TButton;
btnFossilShell: TButton;
btnTests: TButton;
btnCopyLink: TButton;
btnGitAll: TButton;
btnSynProject: TButton;
btnSynPdf: TButton;
btnDMustache: TButton;
btnLVCL: TButton;
chkCopyLink: TCheckBox;
chkFossilPush: TCheckBox;
chkFossilPull: TCheckBox;
procedure FormCreate(Sender: TObject);
procedure btnFullSynchClick(Sender: TObject);
procedure btnFossilSynchClick(Sender: TObject);
procedure btnGitSynchClick(Sender: TObject);
procedure btnRefreshStatusClick(Sender: TObject);
procedure btnGitShellClick(Sender: TObject);
procedure btnFossilShellClick(Sender: TObject);
procedure btnTestsClick(Sender: TObject);
procedure btnCopyLinkClick(Sender: TObject);
private
fBatPath: TFileName;
fFossilRepository: TFileName;
fDevPath: TFileName;
fGitExe: TFileName;
fGitRepository: TFileName;
function Exec(const folder, exe, arg1, arg2, arg3, arg4, arg5: TFileName;
exeisshell: boolean=true; wait: boolean=true): boolean;
procedure ReadStatus;
public
{ Public declarations }
end;
var
MainForm: TMainForm;
implementation
uses
mORMotService; // for cross-platform RunProcess()
{$IFNDEF FPC}
{$R *.dfm}
{$ELSE}
{$R *.lfm}
{$ENDIF}
{$ifdef MSWINDOWS}
{$R ..\..\..\vista.RES} // includes Win10 manifest - use .RES for linux cross-compilation
const
SHELL = '.bat';
SHELLEXE = 'cmd.exe';
GITDEF = 'git.exe';
REPFOSSIL = 'd:\dev\fossil\lib';
REPLIB = 'd:\dev\lib';
REPGITHUB = 'd:\dev\github\';
{$else}
const
SHELL = '.sh';
GITDEF = '/usr/bin/git';
var
REPFOSSIL: TFileName;
REPLIB: TFileName;
REPGITHUB: TFileName;
{$endif}
function TMainForm.Exec(const folder, exe, arg1, arg2, arg3, arg4, arg5: TFileName;
exeisshell, wait: boolean): boolean;
var
bak, path: TFileName;
{$ifdef MSWINDOWS}
function q(const a: TFileName): TFileName;
begin
result := '"' + a + '"'; // paranoid quote for safety
end;
{$else}
type q = TFileName;
{$endif}
begin
if folder <> '' then begin
bak := GetCurrentDir;
SetCurrentDir(folder);
end;
if exeisshell then
path := fBatPath + exe + SHELL
else
path := exe;
screen.Cursor := crHourGlass;
try
result := RunProcess(path, q(arg1), wait, q(arg2), q(arg3), q(arg4), q(arg5)) = 0;
finally
if bak <> '' then
SetCurrentDir(bak);
screen.Cursor := crDefault;
end;
end;
procedure TMainForm.ReadStatus;
var
statusfile: TFileName;
status: RawUTF8;
begin
statusfile := fBatPath + 'status.txt';
DeleteFile(statusfile);
if not Exec(fFossilRepository, 'FossilStatus', statusfile, '', '', '', '') then
status := 'error executing FossilStatus script'
else
status := StringFromFile(statusfile);
{$ifdef MSWINDOWS}
if PosEx(#13#10, status) = 0 then
status := StringReplaceAll(status, #10, #13#10);
{$endif}
mmoStatus.Text := UTF8ToString(status);
end;
procedure TMainForm.FormCreate(Sender: TObject);
{$ifdef MSWINDOWS}
begin
{$else}
var
dev: TFileName;
begin
dev := GetSystemPath(spUserDocuments) + 'dev/';
REPFOSSIL := dev + 'fossil/lib';
REPLIB := dev + 'lib';
REPGITHUB := dev + 'github/';
btnFossilShell.caption := 'Fossil diff';
btnGitShell.caption := 'Git diff';
{$endif MSWINDOWS}
fBatPath := ExeVersion.ProgramFilePath;
if not FileExists(fBatPath + 'FossilStatus' + SHELL) then // from exe sub-folder?
fBatPath := ExtractFilePath(ExcludeTrailingPathDelimiter(fBatPath));
if not FileExists(fBatPath + 'FossilStatus' + SHELL) then // from exe sub-folder?
fBatPath := ExtractFilePath(ExcludeTrailingPathDelimiter(fBatPath));
if not FileExists(fBatPath + 'FossilStatus' + SHELL) then
ShowMessage('Missing *' + SHELL +' files');
fFossilRepository := GetEnvironmentVariable('SYN_FOSSILREPO_PATH');
if fFossilRepository = '' then
fFossilRepository := REPFOSSIL;
fDevPath := GetEnvironmentVariable('SYN_DEVPATH');
if fDevPath = '' then
if DirectoryExists(REPLIB) then
fDevPath := REPLIB else
fDevPath := fFossilRepository;
fGitExe := GetEnvironmentVariable('GIT_PATH');
if fGitExe = '' then begin
{$ifdef MSWINDOWS}
fGitExe := 'c:\Program Files (x86)\Git\bin\git.exe';
if not FileExists(fGitExe) then
{$endif}
fGitExe := GITDEF;
end;
fGitRepository := GetEnvironmentVariable('SYN_GITREPO_PATH');
if fGitRepository = '' then
fGitRepository := REPGITHUB + 'mORMot';
if not DirectoryExists(fFossilRepository) then begin
ShowMessage('Please set Fossil Repository Name or environment variable SYN_FOSSILREPO_PATH');
Close;
end else if not DirectoryExists(fGitRepository) then begin
ShowMessage('Please set Git Repository Path or environment variable SYN_GITREPO_PATH');
Close;
end else if ((fGitExe <> GITDEF) and not FileExists(fGitExe)) or
((fGitExe = GITDEF) and
not Exec(fGitRepository, GITDEF, 'status', '', '', '', '', {isshell=}false)) then begin
ShowMessage('Please install Git or set environment variable GIT_PATH');
Close;
end else
ReadStatus;
end;
procedure TMainForm.btnFullSynchClick(Sender: TObject);
begin
btnFossilSynch.Click;
btnGitSynch.Click;
if chkCopyLink.Checked then
btnCopyLink.Click;
end;
procedure TMainForm.btnFossilSynchClick(Sender: TObject);
var
Desc: string;
DescFile: TFileName;
VersionNumber: integer;
VersionText: RawUTF8;
begin
Desc := trim(mmoDescription.Text);
if Desc = '' then begin
ShowMessage('Missing description');
mmoDescription.SetFocus;
exit;
end;
if chkFossilPull.Checked then
Exec(fFossilRepository, 'FossilUpdate', '', '', '', '', '');
VersionText := UnQuoteSQLString(StringFromFile(fDevPath + PathDelim + 'SynopseCommit.inc'));
VersionText := GetCSVItem(pointer(VersionText), 2, '.');
VersionNumber := GetCardinalDef(pointer(VersionText), 255);
inc(VersionNumber);
VersionText := '''' + VERSION + '.' + UInt32ToUtf8(VersionNumber) + ''''#13#10;
FileFromString(VersionText, fDevPath + PathDelim +'SynopseCommit.inc');
FileFromString(VersionText, fFossilRepository + PathDelim + 'SynopseCommit.inc');
DescFile := fBatPath + 'desc.txt';
FileFromString('{' + ToUTF8(VersionNumber) + '} ' + Desc, DescFile);
Exec(fFossilRepository, 'FossilCommit', DescFile, IntToStr(ord(chkFossilPush.Checked)), fFossilRepository, '', '');
btnRefreshStatus.Click;
end;
procedure TMainForm.btnGitSynchClick(Sender: TObject);
var
Desc, status: string;
DescFile, BatchFile, GitHub: TFileName;
i,n: integer;
begin
Desc := trim(mmoDescription.Text);
if Desc = '' then begin
status := mmoStatus.Text;
i := pos('comment:', status);
if i > 0 then begin
delete(status, 1, i + 8);
with TStringList.Create do
try
Text := trim(status);
status := Strings[0];
for i := 1 to Count - 1 do
if copy(Strings[i], 1, 3) = ' ' then
status := status + ' ' + trim(Strings[i])
else
break;
finally
Free;
end;
i := pos('(user: ', status);
if i > 0 then
SetLength(status, i - 1);
i := pos('} ', status);
if (i > 0) and (i < 10) then
delete(status, 1, i + 1); // trim left '{256} '
mmoDescription.Text := trim(status);
end
else begin
ShowMessage('Missing description');
mmoDescription.SetFocus;
end;
exit;
end;
if not DirectoryExists(fGitRepository) then begin
ShowMessage('Please set Git Repository Name');
exit;
end;
DescFile := fBatPath + 'desc.txt';
FileFromString(Desc, DescFile);
GitHub := ExtractFilePath(fGitRepository);
n := 0;
if (Sender = btnGitAll) or (Sender = btnSynProject) then
inc(n,SynchFolders(fFossilRepository, GitHub + 'SynProject', true, true, true));
if (Sender = btnGitAll) or (Sender = btnSynPdf) then
inc(n,SynchFolders(fFossilRepository, GitHub + 'SynPDF', false, true, true));
if (Sender = btnGitAll) or (Sender = btnDMustache) then
inc(n,SynchFolders(fFossilRepository, GitHub + 'dmustache', false, true, true));
if (Sender = btnGitAll) or (Sender = btnLVCL) then
inc(n,SynchFolders(fFossilRepository, GitHub + 'LVCL', false, true, true));
if (Sender = btnGitAll) or (Sender = btnGitSynch) then
inc(n,SynchFolders(fFossilRepository, GitHub + 'mORMot', true, true, true));
{$I-} Writeln(n,' file(s) synched to GitHub'#13#10); {$I+}
if Sender = btnGitAll then
BatchFile := 'GitCommitAll'
else if Sender = btnSynProject then
BatchFile := 'GitCommitSynProject'
else if Sender = btnSynPdf then
BatchFile := 'GitCommitSynPdf'
else if Sender = btnDMustache then
BatchFile := 'GitCommitDMustache'
else if Sender = btnLVCL then
BatchFile := 'GitCommitLVCL'
else
BatchFile := 'GitCommit';
Exec(fGitRepository, BatchFile, fFossilRepository, fGitRepository, fGitExe, DescFile, fDevPath);
mmoDescription.SetFocus; // ReadStatus not necessary if git only
end;
procedure TMainForm.btnRefreshStatusClick(Sender: TObject);
begin
ReadStatus;
mmoDescription.SetFocus;
mmoDescription.SelectAll;
end;
procedure TMainForm.btnGitShellClick(Sender: TObject);
begin
{$ifdef MSWINDOWS}
Exec(fGitRepository, SHELLEXE, '', '', '', '', '');
{$else}
Exec(fGitRepository, '/usr/bin/meld', fGitRepository, fDevPath, '', '', '', false, false);
{$endif}
end;
procedure TMainForm.btnFossilShellClick(Sender: TObject);
begin
{$ifdef MSWINDOWS}
Exec(fFossilRepository, SHELLEXE, '', '', '', '', '');
{$else}
Exec(fFossilRepository, '/usr/bin/meld', fFossilRepository, fDevPath, '', '', '', false, false);
{$endif}
end;
procedure TMainForm.btnTestsClick(Sender: TObject);
begin
{$ifdef MSWINDOWS}
Exec(fDevPath, 'compilpil', '', '', '', '', '');
{$endif}
end;
procedure TMainForm.btnCopyLinkClick(Sender: TObject);
var
i: integer;
status: string;
begin
status := mmoStatus.Lines.Text;
i := pos('checkout:', status);
if i < 0 then
exit;
inc(i, 10);
while (i < length(status)) and (status[i] <= ' ') do
inc(i);
Clipboard.AsText := 'https://synopse.info/fossil/info/' + copy(status, i, 10);
end;
end.