mirror of
				https://gitlab.com/freepascal.org/lazarus/lazarus.git
				synced 2025-11-04 12:29:27 +01:00 
			
		
		
		
	fixed crash when committing filenames containing spaces
fixed crash in datetime conversion when showing "added" files code refactor for SVNCommitForm and SVNDiffForm, code moved to SVNClasses changed cursor to crHourGlass when recieving data for SVNCommitForm and SVNDiffForm implemented Execute method in SVNCommitForm and calling this Asynchroneously git-svn-id: trunk@17187 -
This commit is contained in:
		
							parent
							
								
									c8dafde3f3
								
							
						
					
					
						commit
						ec0192e830
					
				@ -24,7 +24,7 @@ interface
 | 
			
		||||
 | 
			
		||||
uses
 | 
			
		||||
  Classes, SysUtils, ComCtrls, FileUtil, XMLCfg, LCLProc, Dialogs, Controls,
 | 
			
		||||
  XMLRead, DOM, Process;
 | 
			
		||||
  XMLRead, DOM, Process, StdCtrls, Forms;
 | 
			
		||||
 | 
			
		||||
resourcestring
 | 
			
		||||
  rsAction = 'Action';
 | 
			
		||||
@ -143,6 +143,7 @@ type
 | 
			
		||||
var
 | 
			
		||||
  SVNSettings: TSVNSettings;
 | 
			
		||||
 | 
			
		||||
procedure CmdLineToMemo(CmdLine: string; Memo: TMemo);
 | 
			
		||||
procedure SetColumn(ListView: TListView; ColNo, DefaultWidth: integer; AName: string; AutoSize: boolean = true);
 | 
			
		||||
function SVNExecutable: string;
 | 
			
		||||
function ReplaceLineEndings(const s, NewLineEnds: string): string;
 | 
			
		||||
@ -153,6 +154,81 @@ implementation
 | 
			
		||||
uses
 | 
			
		||||
  SVNAddProjectForm;
 | 
			
		||||
 | 
			
		||||
procedure CmdLineToMemo(CmdLine: string; Memo: TMemo);
 | 
			
		||||
var
 | 
			
		||||
  AProcess: TProcess;
 | 
			
		||||
  BytesRead: LongInt;
 | 
			
		||||
  n: LongInt;
 | 
			
		||||
  M: TMemoryStream;
 | 
			
		||||
  ProcessMsg: string;
 | 
			
		||||
 | 
			
		||||
  procedure UpdateStringsFromStream(Strings: TStrings; var M: TMemoryStream; var BytesRead: LongInt);
 | 
			
		||||
  var
 | 
			
		||||
    s: string;
 | 
			
		||||
  begin
 | 
			
		||||
    SetLength(s, BytesRead);
 | 
			
		||||
    M.Read(s[1], BytesRead);
 | 
			
		||||
 | 
			
		||||
    ProcessMsg := ProcessMsg + ReplaceLineEndings(s, LineEnding);
 | 
			
		||||
    Strings.Text := ProcessMsg;
 | 
			
		||||
 | 
			
		||||
    M.SetSize(0);
 | 
			
		||||
    BytesRead:=0;
 | 
			
		||||
  end;
 | 
			
		||||
 | 
			
		||||
begin
 | 
			
		||||
  ProcessMsg := '';
 | 
			
		||||
 | 
			
		||||
  AProcess := TProcess.Create(nil);
 | 
			
		||||
  AProcess.CommandLine := CmdLine;
 | 
			
		||||
  debugln('CmdLineToMemo commandline=', AProcess.CommandLine);
 | 
			
		||||
  AProcess.Options := AProcess.Options + [poUsePipes, poStdErrToOutput];
 | 
			
		||||
  AProcess.ShowWindow := swoHIDE;
 | 
			
		||||
  AProcess.Execute;
 | 
			
		||||
 | 
			
		||||
  M := TMemoryStream.Create;
 | 
			
		||||
  BytesRead := 0;
 | 
			
		||||
 | 
			
		||||
  while AProcess.Running do
 | 
			
		||||
  begin
 | 
			
		||||
    // make sure we have room
 | 
			
		||||
    M.SetSize(BytesRead + READ_BYTES);
 | 
			
		||||
 | 
			
		||||
    // try reading it
 | 
			
		||||
    n := AProcess.Output.Read((M.Memory + BytesRead)^, READ_BYTES);
 | 
			
		||||
    if n > 0
 | 
			
		||||
    then begin
 | 
			
		||||
      Inc(BytesRead, n);
 | 
			
		||||
      UpdateStringsFromStream(Memo.Lines, M, BytesRead);
 | 
			
		||||
      Application.ProcessMessages;
 | 
			
		||||
    end
 | 
			
		||||
    else
 | 
			
		||||
      // no data, wait 100 ms
 | 
			
		||||
      Sleep(100);
 | 
			
		||||
  end;
 | 
			
		||||
  // read last part
 | 
			
		||||
  repeat
 | 
			
		||||
    // make sure we have room
 | 
			
		||||
    M.SetSize(BytesRead + READ_BYTES);
 | 
			
		||||
    // try reading it
 | 
			
		||||
    n := AProcess.Output.Read((M.Memory + BytesRead)^, READ_BYTES);
 | 
			
		||||
    if n > 0
 | 
			
		||||
    then begin
 | 
			
		||||
      Inc(BytesRead, n);
 | 
			
		||||
      UpdateStringsFromStream(Memo.Lines, M, BytesRead);
 | 
			
		||||
      Application.ProcessMessages;
 | 
			
		||||
    end;
 | 
			
		||||
  until n <= 0;
 | 
			
		||||
  M.SetSize(BytesRead);
 | 
			
		||||
 | 
			
		||||
  UpdateStringsFromStream(Memo.Lines, M, BytesRead);
 | 
			
		||||
 | 
			
		||||
  AProcess.Free;
 | 
			
		||||
  M.Free;
 | 
			
		||||
 | 
			
		||||
  Memo.Cursor:=crDefault;
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
procedure SetColumn(ListView: TListView; ColNo, DefaultWidth: integer; AName: string; AutoSize: boolean = true);
 | 
			
		||||
begin
 | 
			
		||||
  ListView.Column[ColNo].Caption:=AName;
 | 
			
		||||
 | 
			
		||||
@ -2,7 +2,7 @@ object SVNCommitFrm: TSVNCommitFrm
 | 
			
		||||
  Left = 187
 | 
			
		||||
  Height = 300
 | 
			
		||||
  Top = 316
 | 
			
		||||
  Width = 400
 | 
			
		||||
  Width = 675
 | 
			
		||||
  HelpContext = 0
 | 
			
		||||
  ActiveControl = SVNCommitMemo
 | 
			
		||||
  Align = alNone
 | 
			
		||||
@ -18,7 +18,7 @@ object SVNCommitFrm: TSVNCommitFrm
 | 
			
		||||
  ChildSizing.VerticalSpacing = 0
 | 
			
		||||
  ChildSizing.ControlsPerLine = 0
 | 
			
		||||
  ClientHeight = 300
 | 
			
		||||
  ClientWidth = 400
 | 
			
		||||
  ClientWidth = 675
 | 
			
		||||
  DockSite = False
 | 
			
		||||
  DragKind = dkDrag
 | 
			
		||||
  DragMode = dmManual
 | 
			
		||||
@ -26,6 +26,7 @@ object SVNCommitFrm: TSVNCommitFrm
 | 
			
		||||
  Font.Height = 0
 | 
			
		||||
  Font.Style = []
 | 
			
		||||
  FormStyle = fsNormal
 | 
			
		||||
  OnCreate = FormCreate
 | 
			
		||||
  OnShow = FormShow
 | 
			
		||||
  ParentBiDiMode = True
 | 
			
		||||
  ParentFont = False
 | 
			
		||||
@ -38,7 +39,7 @@ object SVNCommitFrm: TSVNCommitFrm
 | 
			
		||||
    Left = 6
 | 
			
		||||
    Height = 48
 | 
			
		||||
    Top = 252
 | 
			
		||||
    Width = 388
 | 
			
		||||
    Width = 663
 | 
			
		||||
    HelpContext = 0
 | 
			
		||||
    Align = alBottom
 | 
			
		||||
    AutoSize = True
 | 
			
		||||
@ -50,10 +51,11 @@ object SVNCommitFrm: TSVNCommitFrm
 | 
			
		||||
    Visible = True
 | 
			
		||||
  end
 | 
			
		||||
  object SVNCommitMemo: TMemo
 | 
			
		||||
    Cursor = crHourGlass
 | 
			
		||||
    Left = 6
 | 
			
		||||
    Height = 240
 | 
			
		||||
    Top = 6
 | 
			
		||||
    Width = 388
 | 
			
		||||
    Width = 663
 | 
			
		||||
    HelpContext = 0
 | 
			
		||||
    Align = alClient
 | 
			
		||||
    Alignment = taLeftJustify
 | 
			
		||||
 | 
			
		||||
@ -2,29 +2,30 @@
 | 
			
		||||
 | 
			
		||||
LazarusResources.Add('TSVNCommitFrm','FORMDATA',[
 | 
			
		||||
  'TPF0'#13'TSVNCommitFrm'#12'SVNCommitFrm'#4'Left'#3#187#0#6'Height'#3','#1#3
 | 
			
		||||
  +'Top'#3'<'#1#5'Width'#3#144#1#11'HelpContext'#2#0#13'ActiveControl'#7#13'SVN'
 | 
			
		||||
  +'Top'#3'<'#1#5'Width'#3#163#2#11'HelpContext'#2#0#13'ActiveControl'#7#13'SVN'
 | 
			
		||||
  +'CommitMemo'#5'Align'#7#6'alNone'#14'AllowDropFiles'#8#10'AutoScroll'#9#8'Au'
 | 
			
		||||
  +'toSize'#8#11'BorderIcons'#11#12'biSystemMenu'#10'biMinimize'#10'biMaximize'
 | 
			
		||||
  +#0#11'BorderStyle'#7#10'bsSizeable'#7'Caption'#6#12'SVNCommitFrm'#28'ChildSi'
 | 
			
		||||
  +'zing.LeftRightSpacing'#2#0#28'ChildSizing.TopBottomSpacing'#2#0#29'ChildSiz'
 | 
			
		||||
  +'ing.HorizontalSpacing'#2#0#27'ChildSizing.VerticalSpacing'#2#0#27'ChildSizi'
 | 
			
		||||
  +'ng.ControlsPerLine'#2#0#12'ClientHeight'#3','#1#11'ClientWidth'#3#144#1#8'D'
 | 
			
		||||
  +'ng.ControlsPerLine'#2#0#12'ClientHeight'#3','#1#11'ClientWidth'#3#163#2#8'D'
 | 
			
		||||
  +'ockSite'#8#8'DragKind'#7#6'dkDrag'#8'DragMode'#7#8'dmManual'#7'Enabled'#9#11
 | 
			
		||||
  +'Font.Height'#2#0#10'Font.Style'#11#0#9'FormStyle'#7#8'fsNormal'#6'OnShow'#7
 | 
			
		||||
  +#8'FormShow'#14'ParentBiDiMode'#9#10'ParentFont'#8#8'Position'#7#14'poScreen'
 | 
			
		||||
  +'Center'#13'ShowInTaskBar'#7#9'stDefault'#14'UseDockManager'#8#10'LCLVersion'
 | 
			
		||||
  +#6#6'0.9.27'#11'WindowState'#7#8'wsNormal'#0#12'TButtonPanel'#11'ButtonPanel'
 | 
			
		||||
  +#4'Left'#2#6#6'Height'#2'0'#3'Top'#3#252#0#5'Width'#3#132#1#11'HelpContext'#2
 | 
			
		||||
  +#0#5'Align'#7#8'alBottom'#8'AutoSize'#9#11'ButtonOrder'#7#9'boDefault'#8'Tab'
 | 
			
		||||
  +'Order'#2#0#13'DefaultButton'#7#4'pbOK'#11'ShowButtons'#11#4'pbOK'#0#10'Show'
 | 
			
		||||
  +'Glyphs'#11#4'pbOK'#8'pbCancel'#7'pbClose'#6'pbHelp'#0#7'Visible'#9#0#0#5'TM'
 | 
			
		||||
  +'emo'#13'SVNCommitMemo'#4'Left'#2#6#6'Height'#3#240#0#3'Top'#2#6#5'Width'#3
 | 
			
		||||
  +#132#1#11'HelpContext'#2#0#5'Align'#7#8'alClient'#9'Alignment'#7#13'taLeftJu'
 | 
			
		||||
  +'stify'#18'BorderSpacing.Left'#2#0#17'BorderSpacing.Top'#2#0#19'BorderSpacin'
 | 
			
		||||
  +'g.Right'#2#0#20'BorderSpacing.Bottom'#2#0#20'BorderSpacing.Around'#2#6'!Bor'
 | 
			
		||||
  +'derSpacing.CellAlignHorizontal'#7#7'ccaFill'#31'BorderSpacing.CellAlignVert'
 | 
			
		||||
  +'ical'#7#7'ccaFill'#10'DragCursor'#7#6'crDrag'#8'DragMode'#7#8'dmManual'#7'E'
 | 
			
		||||
  +'nabled'#9#9'MaxLength'#2#255#14'ParentBidiMode'#9#10'ParentFont'#9#8'ReadOn'
 | 
			
		||||
  +'ly'#9#10'ScrollBars'#7#6'ssNone'#8'TabOrder'#2#1#7'TabStop'#9#7'Visible'#9
 | 
			
		||||
  +#11'WantReturns'#9#8'WantTabs'#8#0#0#0
 | 
			
		||||
  +'Font.Height'#2#0#10'Font.Style'#11#0#9'FormStyle'#7#8'fsNormal'#8'OnCreate'
 | 
			
		||||
  +#7#10'FormCreate'#6'OnShow'#7#8'FormShow'#14'ParentBiDiMode'#9#10'ParentFont'
 | 
			
		||||
  +#8#8'Position'#7#14'poScreenCenter'#13'ShowInTaskBar'#7#9'stDefault'#14'UseD'
 | 
			
		||||
  +'ockManager'#8#10'LCLVersion'#6#6'0.9.27'#11'WindowState'#7#8'wsNormal'#0#12
 | 
			
		||||
  +'TButtonPanel'#11'ButtonPanel'#4'Left'#2#6#6'Height'#2'0'#3'Top'#3#252#0#5'W'
 | 
			
		||||
  +'idth'#3#151#2#11'HelpContext'#2#0#5'Align'#7#8'alBottom'#8'AutoSize'#9#11'B'
 | 
			
		||||
  +'uttonOrder'#7#9'boDefault'#8'TabOrder'#2#0#13'DefaultButton'#7#4'pbOK'#11'S'
 | 
			
		||||
  +'howButtons'#11#4'pbOK'#0#10'ShowGlyphs'#11#4'pbOK'#8'pbCancel'#7'pbClose'#6
 | 
			
		||||
  +'pbHelp'#0#7'Visible'#9#0#0#5'TMemo'#13'SVNCommitMemo'#6'Cursor'#7#11'crHour'
 | 
			
		||||
  +'Glass'#4'Left'#2#6#6'Height'#3#240#0#3'Top'#2#6#5'Width'#3#151#2#11'HelpCon'
 | 
			
		||||
  +'text'#2#0#5'Align'#7#8'alClient'#9'Alignment'#7#13'taLeftJustify'#18'Border'
 | 
			
		||||
  +'Spacing.Left'#2#0#17'BorderSpacing.Top'#2#0#19'BorderSpacing.Right'#2#0#20
 | 
			
		||||
  +'BorderSpacing.Bottom'#2#0#20'BorderSpacing.Around'#2#6'!BorderSpacing.CellA'
 | 
			
		||||
  +'lignHorizontal'#7#7'ccaFill'#31'BorderSpacing.CellAlignVertical'#7#7'ccaFil'
 | 
			
		||||
  +'l'#10'DragCursor'#7#6'crDrag'#8'DragMode'#7#8'dmManual'#7'Enabled'#9#9'MaxL'
 | 
			
		||||
  +'ength'#2#255#14'ParentBidiMode'#9#10'ParentFont'#9#8'ReadOnly'#9#10'ScrollB'
 | 
			
		||||
  +'ars'#7#6'ssNone'#8'TabOrder'#2#1#7'TabStop'#9#7'Visible'#9#11'WantReturns'#9
 | 
			
		||||
  +#8'WantTabs'#8#0#0#0
 | 
			
		||||
]);
 | 
			
		||||
 | 
			
		||||
@ -15,12 +15,14 @@ type
 | 
			
		||||
  TSVNCommitFrm = class(TForm)
 | 
			
		||||
    ButtonPanel: TButtonPanel;
 | 
			
		||||
    SVNCommitMemo: TMemo;
 | 
			
		||||
    procedure FormCreate(Sender: TObject);
 | 
			
		||||
    procedure FormShow(Sender: TObject);
 | 
			
		||||
  private
 | 
			
		||||
    { private declarations }
 | 
			
		||||
    FSVNCommandLine: string;
 | 
			
		||||
  public
 | 
			
		||||
    { public declarations }
 | 
			
		||||
    procedure Execute(Data: PtrInt);
 | 
			
		||||
    property SVNCommandLine: string read FSVNCommandLine write FSVNCommandLine;
 | 
			
		||||
  end; 
 | 
			
		||||
 | 
			
		||||
@ -46,51 +48,18 @@ end;
 | 
			
		||||
{ TSVNCommitFrm }
 | 
			
		||||
 | 
			
		||||
procedure TSVNCommitFrm.FormShow(Sender: TObject);
 | 
			
		||||
var
 | 
			
		||||
  AProcess: TProcess;
 | 
			
		||||
  M: TMemoryStream;
 | 
			
		||||
  BytesRead: LongInt;
 | 
			
		||||
  n: LongInt;
 | 
			
		||||
begin
 | 
			
		||||
  Application.QueueAsyncCall(@Execute, 0);
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
procedure TSVNCommitFrm.Execute(Data: PtrInt);
 | 
			
		||||
begin
 | 
			
		||||
  CmdLineToMemo(SVNCommandLine, SVNCommitMemo);
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
procedure TSVNCommitFrm.FormCreate(Sender: TObject);
 | 
			
		||||
begin
 | 
			
		||||
  Caption := rsLazarusSVNCommit;
 | 
			
		||||
 | 
			
		||||
  //commit the checked files
 | 
			
		||||
  AProcess := TProcess.Create(nil);
 | 
			
		||||
  AProcess.CommandLine := SVNCommandLine;
 | 
			
		||||
  debugln('TSVNCommitFrm.FormShow CommandLine ' + AProcess.CommandLine);
 | 
			
		||||
  AProcess.Options := AProcess.Options + [poUsePipes, poStdErrToOutput];
 | 
			
		||||
  AProcess.ShowWindow := swoHIDE;
 | 
			
		||||
  AProcess.Execute;
 | 
			
		||||
 | 
			
		||||
  M := TMemoryStream.Create;
 | 
			
		||||
  BytesRead := 0;
 | 
			
		||||
 | 
			
		||||
  while AProcess.Running do
 | 
			
		||||
  begin
 | 
			
		||||
    // make sure we have room
 | 
			
		||||
    M.SetSize(BytesRead + READ_BYTES);
 | 
			
		||||
 | 
			
		||||
    // try reading it
 | 
			
		||||
    n := AProcess.Output.Read((M.Memory + BytesRead)^, READ_BYTES);
 | 
			
		||||
    if n > 0 then
 | 
			
		||||
      Inc(BytesRead, n)
 | 
			
		||||
    else
 | 
			
		||||
      // no data, wait 100 ms
 | 
			
		||||
      Sleep(100);
 | 
			
		||||
  end;
 | 
			
		||||
  // read last part
 | 
			
		||||
  repeat
 | 
			
		||||
    // make sure we have room
 | 
			
		||||
    M.SetSize(BytesRead + READ_BYTES);
 | 
			
		||||
    // try reading it
 | 
			
		||||
    n := AProcess.Output.Read((M.Memory + BytesRead)^, READ_BYTES);
 | 
			
		||||
    if n > 0 then
 | 
			
		||||
      Inc(BytesRead, n);
 | 
			
		||||
  until n <= 0;
 | 
			
		||||
  M.SetSize(BytesRead);
 | 
			
		||||
 | 
			
		||||
  SVNCommitMemo.Lines.LoadFromStream(M);
 | 
			
		||||
  M.Free;
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
initialization
 | 
			
		||||
 | 
			
		||||
@ -119,6 +119,7 @@ object SVNDiffFrm: TSVNDiffFrm
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
  object SVNDiffMemo: TMemo
 | 
			
		||||
    Cursor = crHourGlass
 | 
			
		||||
    Left = 6
 | 
			
		||||
    Height = 356
 | 
			
		||||
    Top = 6
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,3 @@
 | 
			
		||||
{ This is an automatically generated lazarus resource file }
 | 
			
		||||
 | 
			
		||||
LazarusResources.Add('TSVNDiffFrm','FORMDATA',[
 | 
			
		||||
  'TPF0'#11'TSVNDiffFrm'#10'SVNDiffFrm'#4'Left'#3#154#0#6'Height'#3#160#1#3'Top'
 | 
			
		||||
  +#3#200#0#5'Width'#3#219#2#11'HelpContext'#2#0#13'ActiveControl'#7#11'SVNDiff'
 | 
			
		||||
@ -79,16 +77,16 @@ LazarusResources.Add('TSVNDiffFrm','FORMDATA',[
 | 
			
		||||
  +'yout'#7#11'blGlyphLeft'#6'Margin'#2#255#11'ModalResult'#2#0#9'NumGlyphs'#2#0
 | 
			
		||||
  +#7'OnClick'#7#15'SaveButtonClick'#10'ParentFont'#9#14'ParentShowHint'#9#7'Sp'
 | 
			
		||||
  +'acing'#2#3#8'TabOrder'#2#4#7'TabStop'#9#7'Visible'#9#0#0#0#5'TMemo'#11'SVND'
 | 
			
		||||
  +'iffMemo'#4'Left'#2#6#6'Height'#3'd'#1#3'Top'#2#6#5'Width'#3#207#2#11'HelpCo'
 | 
			
		||||
  +'ntext'#2#0#5'Align'#7#8'alClient'#9'Alignment'#7#13'taLeftJustify'#18'Borde'
 | 
			
		||||
  +'rSpacing.Left'#2#0#17'BorderSpacing.Top'#2#0#19'BorderSpacing.Right'#2#0#20
 | 
			
		||||
  +'BorderSpacing.Bottom'#2#0#20'BorderSpacing.Around'#2#6'!BorderSpacing.CellA'
 | 
			
		||||
  +'lignHorizontal'#7#7'ccaFill'#31'BorderSpacing.CellAlignVertical'#7#7'ccaFil'
 | 
			
		||||
  +'l'#10'DragCursor'#7#6'crDrag'#8'DragMode'#7#8'dmManual'#7'Enabled'#9#11'Fon'
 | 
			
		||||
  +'t.Height'#2#243#9'Font.Name'#6#7'Courier'#10'Font.Style'#11#0#9'MaxLength'#2
 | 
			
		||||
  +#255#14'ParentBidiMode'#9#10'ParentFont'#8#8'ReadOnly'#8#10'ScrollBars'#7#10
 | 
			
		||||
  +'ssAutoBoth'#8'TabOrder'#2#1#7'TabStop'#9#7'Visible'#9#11'WantReturns'#9#8'W'
 | 
			
		||||
  +'antTabs'#8#0#0#11'TSaveDialog'#10'SaveDialog'#5'Width'#2#0#6'Height'#2#0#10
 | 
			
		||||
  +'DefaultExt'#6#5'.diff'#6'Filter'#6#18'Patch|.diff;.patch'#4'left'#2#21#3'to'
 | 
			
		||||
  +'p'#3'='#1#0#0#0
 | 
			
		||||
  +'iffMemo'#6'Cursor'#7#11'crHourGlass'#4'Left'#2#6#6'Height'#3'd'#1#3'Top'#2#6
 | 
			
		||||
  +#5'Width'#3#207#2#11'HelpContext'#2#0#5'Align'#7#8'alClient'#9'Alignment'#7
 | 
			
		||||
  +#13'taLeftJustify'#18'BorderSpacing.Left'#2#0#17'BorderSpacing.Top'#2#0#19'B'
 | 
			
		||||
  +'orderSpacing.Right'#2#0#20'BorderSpacing.Bottom'#2#0#20'BorderSpacing.Aroun'
 | 
			
		||||
  +'d'#2#6'!BorderSpacing.CellAlignHorizontal'#7#7'ccaFill'#31'BorderSpacing.Ce'
 | 
			
		||||
  +'llAlignVertical'#7#7'ccaFill'#10'DragCursor'#7#6'crDrag'#8'DragMode'#7#8'dm'
 | 
			
		||||
  +'Manual'#7'Enabled'#9#11'Font.Height'#2#243#9'Font.Name'#6#7'Courier'#10'Fon'
 | 
			
		||||
  +'t.Style'#11#0#9'MaxLength'#2#255#14'ParentBidiMode'#9#10'ParentFont'#8#8'Re'
 | 
			
		||||
  +'adOnly'#8#10'ScrollBars'#7#10'ssAutoBoth'#8'TabOrder'#2#1#7'TabStop'#9#7'Vi'
 | 
			
		||||
  +'sible'#9#11'WantReturns'#9#8'WantTabs'#8#0#0#11'TSaveDialog'#10'SaveDialog'
 | 
			
		||||
  +#5'Width'#2#0#6'Height'#2#0#10'DefaultExt'#6#5'.diff'#6'Filter'#6#18'Patch|.'
 | 
			
		||||
  +'diff;.patch'#4'left'#2#21#3'top'#3'='#1#0#0#0
 | 
			
		||||
]);
 | 
			
		||||
 | 
			
		||||
@ -88,55 +88,9 @@ begin
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
procedure TSVNDiffFrm.Execute(Data: PtrInt);
 | 
			
		||||
var
 | 
			
		||||
  AProcess: TProcess;
 | 
			
		||||
  BytesRead: LongInt;
 | 
			
		||||
  n: LongInt;
 | 
			
		||||
  M: TMemoryStream;
 | 
			
		||||
begin
 | 
			
		||||
  AProcess := TProcess.Create(nil);
 | 
			
		||||
  AProcess.CommandLine := SVNExecutable + ' diff ' + FSwitches + ' ' + RepositoryPath + ' --non-interactive';
 | 
			
		||||
  debugln('TSVNDiffFrm.Execute commandline=', AProcess.CommandLine);
 | 
			
		||||
  AProcess.Options := AProcess.Options + [poUsePipes, poStdErrToOutput];
 | 
			
		||||
  AProcess.ShowWindow := swoHIDE;
 | 
			
		||||
  AProcess.Execute;
 | 
			
		||||
 | 
			
		||||
  M := TMemoryStream.Create;
 | 
			
		||||
  BytesRead := 0;
 | 
			
		||||
 | 
			
		||||
  while AProcess.Running do
 | 
			
		||||
  begin
 | 
			
		||||
    // make sure we have room
 | 
			
		||||
    M.SetSize(BytesRead + READ_BYTES);
 | 
			
		||||
 | 
			
		||||
    // try reading it
 | 
			
		||||
    n := AProcess.Output.Read((M.Memory + BytesRead)^, READ_BYTES);
 | 
			
		||||
    if n > 0
 | 
			
		||||
    then begin
 | 
			
		||||
      Inc(BytesRead, n);
 | 
			
		||||
    end
 | 
			
		||||
    else begin
 | 
			
		||||
      // no data, wait 100 ms
 | 
			
		||||
      Sleep(100);
 | 
			
		||||
    end;
 | 
			
		||||
  end;
 | 
			
		||||
  // read last part
 | 
			
		||||
  repeat
 | 
			
		||||
    // make sure we have room
 | 
			
		||||
    M.SetSize(BytesRead + READ_BYTES);
 | 
			
		||||
    // try reading it
 | 
			
		||||
    n := AProcess.Output.Read((M.Memory + BytesRead)^, READ_BYTES);
 | 
			
		||||
    if n > 0
 | 
			
		||||
    then begin
 | 
			
		||||
      Inc(BytesRead, n);
 | 
			
		||||
    end;
 | 
			
		||||
  until n <= 0;
 | 
			
		||||
  M.SetSize(BytesRead);
 | 
			
		||||
 | 
			
		||||
  SVNDiffMemo.Lines.LoadFromStream(M);
 | 
			
		||||
  SVNDiffMemo.Lines.Text := ReplaceLineEndings(SVNDiffMemo.Lines.Text, LineEnding);
 | 
			
		||||
 | 
			
		||||
  AProcess.Free;
 | 
			
		||||
  CmdLineToMemo(SVNExecutable + ' diff ' + FSwitches + ' ' + RepositoryPath + ' --non-interactive',
 | 
			
		||||
                SVNDiffMemo);
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
initialization
 | 
			
		||||
 | 
			
		||||
@ -120,9 +120,9 @@ begin
 | 
			
		||||
 | 
			
		||||
    if StatusItem^.Checked then
 | 
			
		||||
      if pos(RepositoryPath,StatusItem^.Path) = 0 then
 | 
			
		||||
        CmdLine := CmdLine + ' ' + AppendPathDelim(RepositoryPath) + StatusItem^.Path
 | 
			
		||||
        CmdLine := CmdLine + ' ''' + AppendPathDelim(RepositoryPath) + StatusItem^.Path + ''''
 | 
			
		||||
      else
 | 
			
		||||
        CmdLine := CmdLine + ' ' + StatusItem^.Path;
 | 
			
		||||
        CmdLine := CmdLine + ' ''' + StatusItem^.Path + '''';
 | 
			
		||||
  end;
 | 
			
		||||
 | 
			
		||||
  FileName := GetTempFileName('','');
 | 
			
		||||
@ -189,7 +189,8 @@ begin
 | 
			
		||||
      SubItems.Add(StatusItem^.PropStatus);
 | 
			
		||||
 | 
			
		||||
      //check if file is versioned
 | 
			
		||||
      if LowerCase(StatusItem^.ItemStatus) <> 'unversioned' then
 | 
			
		||||
      if (LowerCase(StatusItem^.ItemStatus) <> 'unversioned') and
 | 
			
		||||
         (LowerCase(StatusItem^.ItemStatus) <> 'added') then
 | 
			
		||||
      begin
 | 
			
		||||
        //revision
 | 
			
		||||
        SubItems.Add(IntToStr(StatusItem^.Revision));
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user