-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathudmDiff.pas
66 lines (53 loc) · 1.46 KB
/
udmDiff.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
unit udmDiff;
interface
uses
System.SysUtils,
System.Classes,
Vcl.Forms,
DosCommand
;
type
TdmDiff = class(TDataModule)
DosCommand: TDosCommand;
procedure DataModuleDestroy(Sender: TObject);
procedure DataModuleCreate(Sender: TObject);
procedure DosCommandNewLine(ASender: TObject; const ANewLine: string;
AOutputType: TOutputType);
private
{ Private declarations }
public
{ Public declarations }
OutputLines : TStringList;
procedure MergeDiff(projectdir: string; originalFilename, diffFilename: string);
end;
implementation
{%CLASSGROUP 'System.Classes.TPersistent'}
{$R *.dfm}
procedure TdmDiff.DataModuleDestroy(Sender: TObject);
begin
FreeAndNil(OutputLines);
end;
procedure TdmDiff.DataModuleCreate(Sender: TObject);
begin
OutputLines := TStringList.Create;
end;
procedure TdmDiff.DosCommandNewLine(ASender: TObject; const ANewLine: string;
AOutputType: TOutputType);
begin
if AOutputType = otEntireLine then
OutputLines.Add(ANewLine);
end;
{ TdmDiff }
procedure TdmDiff.MergeDiff(projectDir: string; originalFilename, diffFilename: string);
begin
DosCommand.CurrentDir := projectDir;
DosCommand.CommandLine := Format('"C:\Program Files\TortoiseSVN\bin\TortoiseMerge.exe" /base:"%s" /theirs:"%s"',
[originalFilename, diffFilename]);
DosCommand.Execute;
Sleep(200);
repeat
Application.ProcessMessages;
until not DosCommand.IsRunning;
Sleep(2000);
end;
end.