implemented "SVN revert" in SVNStatusForm

git-svn-id: trunk@17510 -
This commit is contained in:
darius 2008-11-22 11:25:15 +00:00
parent 87d2d92f67
commit 00cff777f4
4 changed files with 56 additions and 16 deletions

View File

@ -57,6 +57,7 @@ resourcestring
rsProjectName = 'Project name';
rsPropertyStatus = 'Property status';
rsRepositoryPath = 'Repository path';
rsRevert = 'Revert';
rsRevision = 'Revision';
rsSave = 'Save';
rsSettings = 'Settings';

View File

@ -123,7 +123,7 @@ object SVNStatusFrm: TSVNStatusFrm
Enabled = True
Font.Height = 0
Font.Style = []
MaxLength = -1
MaxLength = 0
ParentBidiMode = True
ParentFont = False
ReadOnly = False
@ -175,5 +175,11 @@ object SVNStatusFrm: TSVNStatusFrm
ShowAlwaysCheckable = False
OnClick = mnuShowDiffClick
end
object mnuRevert: TMenuItem
Caption = 'New Item2'
RightJustify = False
ShowAlwaysCheckable = False
OnClick = mnuRevertClick
end
end
end

View File

@ -35,18 +35,20 @@ LazarusResources.Add('TSVNStatusFrm','FORMDATA',[
+'ttom'#2#0#20'BorderSpacing.Around'#2#0'!BorderSpacing.CellAlignHorizontal'#7
+#7'ccaFill'#31'BorderSpacing.CellAlignVertical'#7#7'ccaFill'#10'DragCursor'#7
+#6'crDrag'#8'DragMode'#7#8'dmManual'#7'Enabled'#9#11'Font.Height'#2#0#10'Fon'
+'t.Style'#11#0#9'MaxLength'#2#255#14'ParentBidiMode'#9#10'ParentFont'#8#8'Re'
+'adOnly'#8#10'ScrollBars'#7#6'ssNone'#8'TabOrder'#2#1#7'TabStop'#9#7'Visible'
+#9#11'WantReturns'#9#8'WantTabs'#8#0#0#12'TButtonPanel'#11'ButtonPanel'#4'Le'
+'ft'#2#6#6'Height'#2'0'#3'Top'#3'h'#1#5'Width'#3#214#2#11'HelpContext'#2#0#5
+'Align'#7#8'alBottom'#8'AutoSize'#9#11'ButtonOrder'#7#9'boDefault'#8'TabOrde'
+'r'#2#2#13'DefaultButton'#7#4'pbOK'#11'ShowButtons'#11#4'pbOK'#8'pbCancel'#0
+#10'ShowGlyphs'#11#4'pbOK'#8'pbCancel'#7'pbClose'#6'pbHelp'#0#7'Visible'#9#0
+#0#9'TSplitter'#8'Splitter'#6'Cursor'#7#8'crVSplit'#4'Left'#2#0#6'Height'#2#5
+#3'Top'#2'S'#5'Width'#3#226#2#11'HelpContext'#2#0#5'Align'#7#5'alTop'#8'Auto'
+'Snap'#9#7'Beveled'#8#7'MinSize'#2#30#11'ParentColor'#9#14'ParentShowHint'#9
+#12'ResizeAnchor'#7#5'akTop'#11'ResizeStyle'#7#8'rsUpdate'#7'Visible'#9#0#0
+#10'TPopupMenu'#10'PopupMenu1'#4'left'#2'5'#3'top'#3#213#0#0#9'TMenuItem'#11
+'mnuShowDiff'#7'Caption'#6#9'New Item1'#12'RightJustify'#8#19'ShowAlwaysChec'
+'kable'#8#7'OnClick'#7#16'mnuShowDiffClick'#0#0#0#0
+'t.Style'#11#0#9'MaxLength'#2#0#14'ParentBidiMode'#9#10'ParentFont'#8#8'Read'
+'Only'#8#10'ScrollBars'#7#6'ssNone'#8'TabOrder'#2#1#7'TabStop'#9#7'Visible'#9
+#11'WantReturns'#9#8'WantTabs'#8#0#0#12'TButtonPanel'#11'ButtonPanel'#4'Left'
+#2#6#6'Height'#2'0'#3'Top'#3'h'#1#5'Width'#3#214#2#11'HelpContext'#2#0#5'Ali'
+'gn'#7#8'alBottom'#8'AutoSize'#9#11'ButtonOrder'#7#9'boDefault'#8'TabOrder'#2
+#2#13'DefaultButton'#7#4'pbOK'#11'ShowButtons'#11#4'pbOK'#8'pbCancel'#0#10'S'
+'howGlyphs'#11#4'pbOK'#8'pbCancel'#7'pbClose'#6'pbHelp'#0#7'Visible'#9#0#0#9
+'TSplitter'#8'Splitter'#6'Cursor'#7#8'crVSplit'#4'Left'#2#0#6'Height'#2#5#3
+'Top'#2'S'#5'Width'#3#226#2#11'HelpContext'#2#0#5'Align'#7#5'alTop'#8'AutoSn'
+'ap'#9#7'Beveled'#8#7'MinSize'#2#30#11'ParentColor'#9#14'ParentShowHint'#9#12
+'ResizeAnchor'#7#5'akTop'#11'ResizeStyle'#7#8'rsUpdate'#7'Visible'#9#0#0#10
+'TPopupMenu'#10'PopupMenu1'#4'left'#2'5'#3'top'#3#213#0#0#9'TMenuItem'#11'mn'
+'uShowDiff'#7'Caption'#6#9'New Item1'#12'RightJustify'#8#19'ShowAlwaysChecka'
+'ble'#8#7'OnClick'#7#16'mnuShowDiffClick'#0#0#9'TMenuItem'#9'mnuRevert'#7'Ca'
+'ption'#6#9'New Item2'#12'RightJustify'#8#19'ShowAlwaysCheckable'#8#7'OnClic'
+'k'#7#14'mnuRevertClick'#0#0#0#0
]);

View File

@ -24,7 +24,7 @@ interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
ComCtrls, StdCtrls, ButtonPanel, ExtCtrls, LCLProc,
ComCtrls, StdCtrls, ButtonPanel, ExtCtrls, LCLProc, Process,
SVNClasses, Menus;
type
@ -32,6 +32,7 @@ type
TSVNStatusFrm = class(TForm)
ButtonPanel: TButtonPanel;
mnuRevert: TMenuItem;
mnuShowDiff: TMenuItem;
PopupMenu1: TPopupMenu;
Splitter: TSplitter;
@ -40,6 +41,7 @@ type
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure mnuRevertClick(Sender: TObject);
procedure mnuShowDiffClick(Sender: TObject);
procedure OKButtonClick(Sender: TObject);
procedure SVNFileListViewColumnClick(Sender: TObject; Column: TListColumn);
@ -87,6 +89,34 @@ begin
Application.QueueAsyncCall(@UpdateFilesListView, 0);
end;
procedure TSVNStatusFrm.mnuRevertClick(Sender: TObject);
var
AProcess: TProcess;
begin
if Assigned(SVNFileListView.Selected) then
begin
AProcess := TProcess.Create(nil);
if pos(RepositoryPath,SVNFileListView.Selected.SubItems[0]) <> 0 then
AProcess.CommandLine := SVNExecutable + ' revert ' + SVNFileListView.Selected.SubItems[0]
else
AProcess.CommandLine := SVNExecutable + ' revert ' + AppendPathDelim(RepositoryPath) + SVNFileListView.Selected.SubItems[0];
debugln('TSVNStatusFrm.mnuRevertClick commandline=', AProcess.CommandLine);
AProcess.Options := AProcess.Options + [poWaitOnExit];
AProcess.ShowWindow := swoHIDE;
AProcess.Execute;
AProcess.Free;
//now delete the entry from the list
SVNStatus.List.Delete(SVNFileListView.Selected.Index);
//update the listview again
UpdateFilesListView(0);
end;
end;
procedure TSVNStatusFrm.mnuShowDiffClick(Sender: TObject);
begin
{$note implement opening file in source editor}
@ -233,6 +263,7 @@ begin
ChangeCursor(crHourGlass);
mnuShowDiff.Caption:=rsShowDiff;
mnuRevert.Caption := rsRevert;
ButtonPanel.OKButton.OnClick:=@OKButtonClick;