mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 14:38:01 +02:00
LazSvn package: fix memory leaks. Clean the code by using generics containers and objects instead of records.
git-svn-id: trunk@35469 -
This commit is contained in:
parent
44740de026
commit
1a743bf4bc
@ -29,6 +29,14 @@ msgstr "Autor"
|
||||
msgid "Commit"
|
||||
msgstr "Übertragung"
|
||||
|
||||
#: svnclasses.rscommitmsg
|
||||
msgid "Commit Message"
|
||||
msgstr ""
|
||||
|
||||
#: svnclasses.rscommitmsghistory
|
||||
msgid "Commit Message History"
|
||||
msgstr ""
|
||||
|
||||
#: svnclasses.rscommitrevision
|
||||
msgid "Commit revision"
|
||||
msgstr "Übertrage Revision"
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Massimo Soricetti <notturno@quipo.it>, 2011.
|
||||
Massimo Soricetti <notturno@quipo.it>, 2011.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"PO-Revision-Date: 2011-04-19 01:57+0200\n"
|
||||
@ -31,6 +31,14 @@ msgstr "Autore"
|
||||
msgid "Commit"
|
||||
msgstr ""
|
||||
|
||||
#: svnclasses.rscommitmsg
|
||||
msgid "Commit Message"
|
||||
msgstr ""
|
||||
|
||||
#: svnclasses.rscommitmsghistory
|
||||
msgid "Commit Message History"
|
||||
msgstr ""
|
||||
|
||||
#: svnclasses.rscommitrevision
|
||||
msgid "Commit revision"
|
||||
msgstr "Commit della revisione"
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Valdas Jankūnas <zmuogs@gmail.com>, 2010.
|
||||
Valdas Jankūnas <zmuogs@gmail.com>, 2010.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
@ -31,6 +31,14 @@ msgstr "Autorius"
|
||||
msgid "Commit"
|
||||
msgstr "Nusiųsta"
|
||||
|
||||
#: svnclasses.rscommitmsg
|
||||
msgid "Commit Message"
|
||||
msgstr ""
|
||||
|
||||
#: svnclasses.rscommitmsghistory
|
||||
msgid "Commit Message History"
|
||||
msgstr ""
|
||||
|
||||
#: svnclasses.rscommitrevision
|
||||
msgid "Commit revision"
|
||||
msgstr "Nusiuntimo laida"
|
||||
|
@ -21,6 +21,14 @@ msgstr ""
|
||||
msgid "Commit"
|
||||
msgstr ""
|
||||
|
||||
#: svnclasses.rscommitmsg
|
||||
msgid "Commit Message"
|
||||
msgstr ""
|
||||
|
||||
#: svnclasses.rscommitmsghistory
|
||||
msgid "Commit Message History"
|
||||
msgstr ""
|
||||
|
||||
#: svnclasses.rscommitrevision
|
||||
msgid "Commit revision"
|
||||
msgstr ""
|
||||
|
@ -29,6 +29,14 @@ msgstr "Autor"
|
||||
msgid "Commit"
|
||||
msgstr "Enviar"
|
||||
|
||||
#: svnclasses.rscommitmsg
|
||||
msgid "Commit Message"
|
||||
msgstr ""
|
||||
|
||||
#: svnclasses.rscommitmsghistory
|
||||
msgid "Commit Message History"
|
||||
msgstr ""
|
||||
|
||||
#: svnclasses.rscommitrevision
|
||||
msgid "Commit revision"
|
||||
msgstr "Enviar revisão"
|
||||
|
@ -29,6 +29,14 @@ msgstr "Autor"
|
||||
msgid "Commit"
|
||||
msgstr "Enviar"
|
||||
|
||||
#: svnclasses.rscommitmsg
|
||||
msgid "Commit Message"
|
||||
msgstr ""
|
||||
|
||||
#: svnclasses.rscommitmsghistory
|
||||
msgid "Commit Message History"
|
||||
msgstr ""
|
||||
|
||||
#: svnclasses.rscommitrevision
|
||||
msgid "Commit revision"
|
||||
msgstr "Enviar revisão"
|
||||
|
@ -29,6 +29,14 @@ msgstr "Автор"
|
||||
msgid "Commit"
|
||||
msgstr "Фиксировать"
|
||||
|
||||
#: svnclasses.rscommitmsg
|
||||
msgid "Commit Message"
|
||||
msgstr ""
|
||||
|
||||
#: svnclasses.rscommitmsghistory
|
||||
msgid "Commit Message History"
|
||||
msgstr ""
|
||||
|
||||
#: svnclasses.rscommitrevision
|
||||
msgid "Commit revision"
|
||||
msgstr "Ревизия с изменениями"
|
||||
|
@ -29,6 +29,14 @@ msgstr "Автор"
|
||||
msgid "Commit"
|
||||
msgstr "Фіксувати зміни"
|
||||
|
||||
#: svnclasses.rscommitmsg
|
||||
msgid "Commit Message"
|
||||
msgstr ""
|
||||
|
||||
#: svnclasses.rscommitmsghistory
|
||||
msgid "Commit Message History"
|
||||
msgstr ""
|
||||
|
||||
#: svnclasses.rscommitrevision
|
||||
msgid "Commit revision"
|
||||
msgstr "Ревізія зі змінами"
|
||||
|
@ -24,7 +24,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, ComCtrls, FileUtil, LCLProc, Controls,
|
||||
XMLRead, DOM, Process, StdCtrls, Forms;
|
||||
XMLRead, DOM, Process, StdCtrls, Forms, contnrs, fgl;
|
||||
|
||||
resourcestring
|
||||
rsAction = 'Action';
|
||||
@ -96,8 +96,8 @@ type
|
||||
TStatusItemName = (siChecked, siPath, siExtension, siPropStatus, siItemStatus,
|
||||
siRevision, siCommitRevision, siAuthor, siDate);
|
||||
|
||||
PSVNStatusItem = ^TSVNStatusItem;
|
||||
TSVNStatusItem = record
|
||||
// PSVNStatusItem = ^TSVNStatusItem;
|
||||
TSVNStatusItem = class //record
|
||||
Checked: boolean;
|
||||
Path: string;
|
||||
Extension: string;
|
||||
@ -109,6 +109,8 @@ type
|
||||
Date: TDate;
|
||||
end;
|
||||
|
||||
TSVNStatusList = specialize TFPGObjectList<TSVNStatusItem>;
|
||||
|
||||
{ TSVNStatus }
|
||||
|
||||
TSVNStatus = class(TObject)
|
||||
@ -117,7 +119,7 @@ type
|
||||
FSortDirection: TSortDirection;
|
||||
FSortItem: TStatusItemName;
|
||||
public
|
||||
List: TFPList;
|
||||
List: TSVNStatusList; // TFPList;
|
||||
|
||||
constructor Create(const ARepoPath: string; verbose: Boolean);
|
||||
destructor Destroy; override;
|
||||
@ -261,116 +263,116 @@ begin
|
||||
Result := EncodeDate(y,m,d) + EncodeTime(h,n,s,0);
|
||||
end;
|
||||
|
||||
function SortPathAscending(Item1, Item2: Pointer): Integer;
|
||||
function SortPathAscending(const Item1, Item2: TSVNStatusItem): Integer;
|
||||
begin
|
||||
Result := CompareText(PSVNStatusItem(Item1)^.Path, PSVNStatusItem(Item2)^.Path);
|
||||
Result := CompareText(Item1.Path, Item2.Path);
|
||||
end;
|
||||
|
||||
function SortPathDescending(Item1, Item2: Pointer): Integer;
|
||||
function SortPathDescending(const Item1, Item2: TSVNStatusItem): Integer;
|
||||
begin
|
||||
Result := -SortPathAscending(Item1, Item2);
|
||||
end;
|
||||
|
||||
function SortSelectedAscending(Item1, Item2: Pointer): Integer;
|
||||
function SortSelectedAscending(const Item1, Item2: TSVNStatusItem): Integer;
|
||||
begin
|
||||
if PSVNStatusItem(Item1)^.Checked > PSVNStatusItem(Item2)^.Checked then
|
||||
if Item1.Checked > Item2.Checked then
|
||||
Result := 1
|
||||
else
|
||||
if PSVNStatusItem(Item1)^.Checked = PSVNStatusItem(Item2)^.Checked then
|
||||
if Item1.Checked = Item2.Checked then
|
||||
Result := SortPathDescending(Item1, Item2)
|
||||
else
|
||||
Result := -1;
|
||||
end;
|
||||
|
||||
function SortSelectedDescending(Item1, Item2: Pointer): Integer;
|
||||
function SortSelectedDescending(const Item1, Item2: TSVNStatusItem): Integer;
|
||||
begin
|
||||
Result := -SortSelectedAscending(Item1, Item2);
|
||||
end;
|
||||
|
||||
function SortExtensionAscending(Item1, Item2: Pointer): Integer;
|
||||
function SortExtensionAscending(const Item1, Item2: TSVNStatusItem): Integer;
|
||||
begin
|
||||
Result := CompareText(PSVNStatusItem(Item1)^.Extension, PSVNStatusItem(Item2)^.Extension);
|
||||
Result := CompareText(Item1.Extension, Item2.Extension);
|
||||
end;
|
||||
|
||||
function SortExtensionDescending(Item1, Item2: Pointer): Integer;
|
||||
function SortExtensionDescending(const Item1, Item2: TSVNStatusItem): Integer;
|
||||
begin
|
||||
Result := -SortExtensionAscending(Item1, Item2);
|
||||
end;
|
||||
|
||||
function SortItemStatusAscending(Item1, Item2: Pointer): Integer;
|
||||
function SortItemStatusAscending(const Item1, Item2: TSVNStatusItem): Integer;
|
||||
begin
|
||||
Result := CompareText(PSVNStatusItem(Item1)^.ItemStatus, PSVNStatusItem(Item2)^.ItemStatus);
|
||||
Result := CompareText(Item1.ItemStatus, Item2.ItemStatus);
|
||||
end;
|
||||
|
||||
function SortItemStatusDescending(Item1, Item2: Pointer): Integer;
|
||||
function SortItemStatusDescending(const Item1, Item2: TSVNStatusItem): Integer;
|
||||
begin
|
||||
Result := -SortItemStatusAscending(Item1, Item2);
|
||||
end;
|
||||
|
||||
function SortPropStatusAscending(Item1, Item2: Pointer): Integer;
|
||||
function SortPropStatusAscending(const Item1, Item2: TSVNStatusItem): Integer;
|
||||
begin
|
||||
Result := CompareText(PSVNStatusItem(Item1)^.PropStatus, PSVNStatusItem(Item2)^.PropStatus);
|
||||
Result := CompareText(Item1.PropStatus, Item2.PropStatus);
|
||||
end;
|
||||
|
||||
function SortPropStatusDescending(Item1, Item2: Pointer): Integer;
|
||||
function SortPropStatusDescending(const Item1, Item2: TSVNStatusItem): Integer;
|
||||
begin
|
||||
Result := -SortPropStatusAscending(Item1, Item2);
|
||||
end;
|
||||
|
||||
function SortPropertyAuthorAscending(Item1, Item2: Pointer): Integer;
|
||||
function SortPropertyAuthorAscending(const Item1, Item2: TSVNStatusItem): Integer;
|
||||
begin
|
||||
Result := CompareText(PSVNStatusItem(Item1)^.Author, PSVNStatusItem(Item2)^.Author);
|
||||
Result := CompareText(Item1.Author, Item2.Author);
|
||||
end;
|
||||
|
||||
function SortPropertyAuthorDescending(Item1, Item2: Pointer): Integer;
|
||||
function SortPropertyAuthorDescending(const Item1, Item2: TSVNStatusItem): Integer;
|
||||
begin
|
||||
Result := -SortPropertyAuthorAscending(Item1, Item2);
|
||||
end;
|
||||
|
||||
function SortPropertyRevisionAscending(Item1, Item2: Pointer): Integer;
|
||||
function SortPropertyRevisionAscending(const Item1, Item2: TSVNStatusItem): Integer;
|
||||
begin
|
||||
if PSVNStatusItem(Item1)^.Revision > PSVNStatusItem(Item2)^.Revision then
|
||||
if Item1.Revision > Item2.Revision then
|
||||
Result := 1
|
||||
else
|
||||
if PSVNStatusItem(Item1)^.Revision = PSVNStatusItem(Item2)^.Revision then
|
||||
if Item1.Revision = Item2.Revision then
|
||||
Result := 0
|
||||
else
|
||||
Result := -1;
|
||||
end;
|
||||
|
||||
function SortPropertyRevisionDescending(Item1, Item2: Pointer): Integer;
|
||||
function SortPropertyRevisionDescending(const Item1, Item2: TSVNStatusItem): Integer;
|
||||
begin
|
||||
Result := -SortPropertyRevisionAscending(Item1, Item2);
|
||||
end;
|
||||
|
||||
function SortPropertyCommitRevisionAscending(Item1, Item2: Pointer): Integer;
|
||||
function SortPropertyCommitRevisionAscending(const Item1, Item2: TSVNStatusItem): Integer;
|
||||
begin
|
||||
if PSVNStatusItem(Item1)^.CommitRevision > PSVNStatusItem(Item2)^.CommitRevision then
|
||||
if Item1.CommitRevision > Item2.CommitRevision then
|
||||
Result := 1
|
||||
else
|
||||
if PSVNStatusItem(Item1)^.CommitRevision = PSVNStatusItem(Item2)^.CommitRevision then
|
||||
if Item1.CommitRevision = Item2.CommitRevision then
|
||||
Result := 0
|
||||
else
|
||||
Result := -1;
|
||||
end;
|
||||
|
||||
function SortPropertyCommitRevisionDescending(Item1, Item2: Pointer): Integer;
|
||||
function SortPropertyCommitRevisionDescending(const Item1, Item2: TSVNStatusItem): Integer;
|
||||
begin
|
||||
Result := -SortPropertyCommitRevisionAscending(Item1, Item2);
|
||||
end;
|
||||
|
||||
function SortPropertyDateAscending(Item1, Item2: Pointer): Integer;
|
||||
function SortPropertyDateAscending(const Item1, Item2: TSVNStatusItem): Integer;
|
||||
begin
|
||||
if PSVNStatusItem(Item1)^.Date > PSVNStatusItem(Item2)^.Date then
|
||||
if Item1.Date > Item2.Date then
|
||||
Result := 1
|
||||
else
|
||||
if PSVNStatusItem(Item1)^.Date = PSVNStatusItem(Item2)^.Date then
|
||||
if Item1.Date = Item2.Date then
|
||||
Result := 0
|
||||
else
|
||||
Result := -1;
|
||||
end;
|
||||
|
||||
function SortPropertyDateDescending(Item1, Item2: Pointer): Integer;
|
||||
function SortPropertyDateDescending(const Item1, Item2: TSVNStatusItem): Integer;
|
||||
begin
|
||||
Result := -SortPropertyDateAscending(Item1, Item2);
|
||||
end;
|
||||
@ -436,14 +438,14 @@ var
|
||||
Doc: TXMLDocument;
|
||||
F: LongInt;
|
||||
i: integer;
|
||||
ListItem: PSVNStatusItem;
|
||||
ListItem: TSVNStatusItem;
|
||||
Node: TDOMNode;
|
||||
NodeName: string;
|
||||
NodeValue: string;
|
||||
Path: string;
|
||||
SubNode: TDOMNode;
|
||||
begin
|
||||
List := TFPList.Create;
|
||||
List := TSVNStatusList.Create;
|
||||
RepositoryPath := ARepoPath;
|
||||
|
||||
if Verbose then
|
||||
@ -460,81 +462,63 @@ begin
|
||||
|
||||
repeat
|
||||
SubNode := Node;
|
||||
|
||||
New(ListItem);
|
||||
|
||||
Path := SubNode.Attributes.Item[0].NodeValue;
|
||||
debugln('TSVNStatus.Create ' + Path);
|
||||
|
||||
F:=FileGetAttr(Path);
|
||||
If F<>-1 then
|
||||
If (F and faDirectory)=0 then
|
||||
If (F<>-1) and ((F and faDirectory)=0) then
|
||||
begin
|
||||
ListItem := TSVNStatusItem.Create;
|
||||
//initialize author (anonymous repositories)
|
||||
ListItem.Author := rsNoAuthor;
|
||||
//path
|
||||
ListItem.Path := Path;
|
||||
//Extension
|
||||
ListItem.Extension:=ExtractFileExt(Path);
|
||||
//get the wc-status attributes
|
||||
ListItem.ItemStatus:='';
|
||||
ListItem.Checked:=False;
|
||||
ListItem.PropStatus:='';
|
||||
for i := 0 to SubNode.ChildNodes.Item[0].Attributes.Length -1 do
|
||||
begin
|
||||
//initialize author (anonymous repositories)
|
||||
ListItem^.Author := rsNoAuthor;
|
||||
|
||||
//path
|
||||
ListItem^.Path := Path;
|
||||
|
||||
//Extension
|
||||
ListItem^.Extension:=ExtractFileExt(Path);
|
||||
|
||||
//get the wc-status attributes
|
||||
ListItem^.ItemStatus:='';
|
||||
ListItem^.Checked:=False;
|
||||
ListItem^.PropStatus:='';
|
||||
for i := 0 to SubNode.ChildNodes.Item[0].Attributes.Length -1 do
|
||||
NodeName := SubNode.ChildNodes.Item[0].Attributes.Item[i].NodeName;
|
||||
NodeValue := SubNode.ChildNodes.Item[0].Attributes.Item[i].NodeValue;
|
||||
if NodeName = 'item' then
|
||||
begin
|
||||
NodeName := SubNode.ChildNodes.Item[0].Attributes.Item[i].NodeName;
|
||||
NodeValue := SubNode.ChildNodes.Item[0].Attributes.Item[i].NodeValue;
|
||||
|
||||
if NodeName = 'item' then
|
||||
begin
|
||||
//ItemStatus
|
||||
ListItem^.ItemStatus := LowerCase(NodeValue);
|
||||
|
||||
//Checked
|
||||
ListItem^.Checked:=(NodeValue<>'unversioned') and (NodeValue<>'normal');
|
||||
end;
|
||||
|
||||
if NodeName = 'props' then
|
||||
//PropStatus
|
||||
ListItem^.PropStatus := NodeValue;
|
||||
|
||||
if NodeName = 'revision' then
|
||||
//Revision
|
||||
ListItem^.Revision := StrToInt(NodeValue);
|
||||
//ItemStatus
|
||||
ListItem.ItemStatus := LowerCase(NodeValue);
|
||||
//Checked
|
||||
ListItem.Checked:=(NodeValue<>'unversioned') and (NodeValue<>'normal');
|
||||
end;
|
||||
|
||||
//get the commit attributes
|
||||
SubNode := SubNode.ChildNodes.Item[0].ChildNodes.Item[0];
|
||||
if Assigned(SubNode) then
|
||||
begin
|
||||
//CommitRevision
|
||||
ListItem^.CommitRevision:=StrToInt(SubNode.Attributes.Item[0].NodeValue);
|
||||
|
||||
for i := 0 to SubNode.ChildNodes.Count - 1 do
|
||||
begin
|
||||
ActNode := SubNode.ChildNodes.Item[i];
|
||||
|
||||
if Assigned(ActNode) then
|
||||
begin
|
||||
NodeName := ActNode.NodeName;
|
||||
|
||||
//Author
|
||||
if NodeName = 'author' then
|
||||
ListItem^.Author := ActNode.FirstChild.NodeValue;
|
||||
|
||||
//Date
|
||||
if NodeName = 'date' then
|
||||
ListItem^.Date := ISO8601ToDateTime(ActNode.FirstChild.NodeValue);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
List.Add(ListItem);
|
||||
if NodeName = 'props' then
|
||||
//PropStatus
|
||||
ListItem.PropStatus := NodeValue;
|
||||
if NodeName = 'revision' then
|
||||
//Revision
|
||||
ListItem.Revision := StrToInt(NodeValue);
|
||||
end;
|
||||
|
||||
//get the commit attributes
|
||||
SubNode := SubNode.ChildNodes.Item[0].ChildNodes.Item[0];
|
||||
if Assigned(SubNode) then
|
||||
begin
|
||||
//CommitRevision
|
||||
ListItem.CommitRevision:=StrToInt(SubNode.Attributes.Item[0].NodeValue);
|
||||
for i := 0 to SubNode.ChildNodes.Count - 1 do
|
||||
begin
|
||||
ActNode := SubNode.ChildNodes.Item[i];
|
||||
if Assigned(ActNode) then
|
||||
begin
|
||||
NodeName := ActNode.NodeName;
|
||||
//Author
|
||||
if NodeName = 'author' then
|
||||
ListItem.Author := ActNode.FirstChild.NodeValue;
|
||||
//Date
|
||||
if NodeName = 'date' then
|
||||
ListItem.Date := ISO8601ToDateTime(ActNode.FirstChild.NodeValue);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
List.Add(ListItem);
|
||||
end;
|
||||
Node := Node.NextSibling;
|
||||
until not Assigned(Node);
|
||||
Doc.Free;
|
||||
@ -543,7 +527,6 @@ end;
|
||||
destructor TSVNStatus.Destroy;
|
||||
begin
|
||||
List.Free;
|
||||
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
|
@ -18,9 +18,9 @@ object SVNLogFrm: TSVNLogFrm
|
||||
AnchorSideBottom.Control = SVNLogLimit
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 14
|
||||
Top = 502
|
||||
Width = 102
|
||||
Height = 16
|
||||
Top = 500
|
||||
Width = 128
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Right = 6
|
||||
@ -66,7 +66,7 @@ object SVNLogFrm: TSVNLogFrm
|
||||
object SVNActionsListView: TListView
|
||||
AnchorSideBottom.Control = RefreshButton
|
||||
Left = 6
|
||||
Height = 213
|
||||
Height = 211
|
||||
Top = 274
|
||||
Width = 714
|
||||
Align = alTop
|
||||
@ -95,12 +95,16 @@ object SVNLogFrm: TSVNLogFrm
|
||||
Top = 522
|
||||
Width = 714
|
||||
OKButton.Name = 'OKButton'
|
||||
OKButton.DefaultCaption = True
|
||||
OKButton.OnClick = OKButtonClick
|
||||
HelpButton.Name = 'HelpButton'
|
||||
HelpButton.DefaultCaption = True
|
||||
HelpButton.Enabled = False
|
||||
CloseButton.Name = 'CloseButton'
|
||||
CloseButton.DefaultCaption = True
|
||||
CloseButton.Enabled = False
|
||||
CancelButton.Name = 'CancelButton'
|
||||
CancelButton.DefaultCaption = True
|
||||
CancelButton.Enabled = False
|
||||
TabOrder = 3
|
||||
ShowButtons = [pbOK]
|
||||
@ -127,7 +131,7 @@ object SVNLogFrm: TSVNLogFrm
|
||||
AnchorSideLeft.Control = Label1
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideBottom.Control = ButtonPanel
|
||||
Left = 114
|
||||
Left = 140
|
||||
Height = 23
|
||||
Top = 493
|
||||
Width = 94
|
||||
@ -141,10 +145,10 @@ object SVNLogFrm: TSVNLogFrm
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = ButtonPanel
|
||||
Left = 671
|
||||
Height = 23
|
||||
Top = 493
|
||||
Width = 49
|
||||
Left = 663
|
||||
Height = 25
|
||||
Top = 491
|
||||
Width = 57
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
|
@ -206,7 +206,8 @@ procedure TSVNLogFrm.FormShow(Sender: TObject);
|
||||
begin
|
||||
ChangeCursor(crHourGlass);
|
||||
Caption := Format(rsLazarusSVNLog, [RepositoryPath]);
|
||||
Application.QueueAsyncCall(@Execute, 0);
|
||||
// Application.QueueAsyncCall(@Execute, 0);
|
||||
Execute(0);
|
||||
end;
|
||||
|
||||
procedure TSVNLogFrm.LogListViewSelectItem(Sender: TObject; Item: TListItem;
|
||||
@ -218,18 +219,13 @@ var
|
||||
begin
|
||||
if not Selected then
|
||||
exit; // this event always fires twice, once for select and once for unselect
|
||||
|
||||
RevNo := StrToInt(Item.Caption);
|
||||
|
||||
SVNLogItem := FindSVNLogItemByRevision(LogList, RevNo);
|
||||
|
||||
SVNActionsListView.Visible := False; // BeginUpdate won't help when autosize is true
|
||||
SVNActionsListView.Clear;
|
||||
|
||||
if Assigned(SVNLogItem) then
|
||||
begin
|
||||
SVNLogMsgMemo.Lines.Text:=SVNLogItem.Msg;
|
||||
|
||||
for i := 0 to SVNLogItem.Count - 1 do
|
||||
with SVNActionsListView.Items.Add do
|
||||
begin
|
||||
@ -280,9 +276,9 @@ end;
|
||||
|
||||
procedure TSVNLogFrm.ChangeCursor(ACursor: TCursor);
|
||||
begin
|
||||
//LogListView.Cursor:=ACursor;
|
||||
LogListView.Cursor:=ACursor;
|
||||
SVNLogMsgMemo.Cursor:=ACursor;
|
||||
//SVNActionsListView.Cursor:=ACursor;
|
||||
SVNActionsListView.Cursor:=ACursor;
|
||||
Self.Cursor:=ACursor;
|
||||
Application.ProcessMessages;
|
||||
end;
|
||||
@ -446,57 +442,40 @@ begin
|
||||
InfoUrl := Node.TextContent;
|
||||
Node := Doc.DocumentElement.FirstChild.FindNode('repository').FindNode('root');
|
||||
InfoRoot := Node.TextContent;
|
||||
except
|
||||
Doc.Free;
|
||||
UpdateLogListView;
|
||||
ChangeCursor(crDefault);
|
||||
exit();
|
||||
end;
|
||||
Doc.Free;
|
||||
|
||||
Doc := ExecuteSvnReturnXml('log --xml --verbose --limit ' + IntToStr(SVNLogLimit.Value) + ' "' + RepositoryPath + '" --non-interactive');
|
||||
LogList.Clear;
|
||||
Node := Doc.DocumentElement.FirstChild;
|
||||
if Assigned(Node) then
|
||||
begin
|
||||
Doc := ExecuteSvnReturnXml('log --xml --verbose --limit ' + IntToStr(SVNLogLimit.Value) + ' "' + RepositoryPath + '" --non-interactive');
|
||||
LogList.Clear;
|
||||
Node := Doc.DocumentElement.FirstChild;
|
||||
if Assigned(Node) then
|
||||
repeat
|
||||
SubNode := Node;
|
||||
|
||||
LogItem := TSVNLogItem.Create;
|
||||
|
||||
//revision
|
||||
LogItem.Revision := StrToInt(SubNode.Attributes.Item[0].NodeValue);
|
||||
|
||||
//action
|
||||
tmpNode := SubNode.FirstChild;
|
||||
while Assigned(tmpNode) do
|
||||
begin
|
||||
NodeName := tmpNode.NodeName;
|
||||
|
||||
//Author
|
||||
if NodeName = 'author' then
|
||||
LogItem.Author := tmpNode.FirstChild.NodeValue;
|
||||
|
||||
//Date
|
||||
if NodeName = 'date' then
|
||||
LogItem.Date := ISO8601ToDateTime(tmpNode.FirstChild.NodeValue);
|
||||
|
||||
//message
|
||||
if NodeName = 'msg' then
|
||||
if Assigned(tmpNode.FirstChild) then
|
||||
LogItem.Msg:=ReplaceLineEndings(tmpNode.FirstChild.NodeValue, LineEnding);
|
||||
|
||||
ActionNode := tmpNode.FirstChild;
|
||||
if Assigned(ActionNode) and Assigned(ActionNode.Attributes) then
|
||||
repeat
|
||||
ActionItem.CopyRev := '';
|
||||
ActionItem.CopyPath := '';
|
||||
|
||||
//attributes
|
||||
for i := 0 to ActionNode.Attributes.Length-1 do
|
||||
begin
|
||||
t := ActionNode.Attributes.Item[i].NodeName;
|
||||
|
||||
if t = 'action' then
|
||||
ActionItem.Action := ActionNode.Attributes.Item[i].NodeValue
|
||||
else
|
||||
@ -507,25 +486,21 @@ begin
|
||||
ActionItem.CopyPath := AbsPath(
|
||||
ActionNode.Attributes.Item[i].NodeValue);
|
||||
end;
|
||||
|
||||
//paths
|
||||
ActionItem.Path:=AbsPath(ActionNode.FirstChild.NodeValue);
|
||||
|
||||
LogItem.AddAction(ActionItem);
|
||||
ActionNode := ActionNode.NextSibling;
|
||||
until not Assigned(ActionNode);
|
||||
tmpNode := tmpNode.NextSibling;
|
||||
|
||||
end;
|
||||
|
||||
LogList.Add(LogItem);
|
||||
|
||||
Node := Node.NextSibling;
|
||||
until not Assigned(Node);
|
||||
finally
|
||||
Doc.Free;
|
||||
UpdateLogListView;
|
||||
ChangeCursor(crDefault);
|
||||
end;
|
||||
Doc.Free;
|
||||
UpdateLogListView;
|
||||
ChangeCursor(crDefault);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -14,8 +14,8 @@ object SVNStatusFrm: TSVNStatusFrm
|
||||
LCLVersion = '0.9.31'
|
||||
object ButtonPanel: TButtonPanel
|
||||
Left = 6
|
||||
Height = 41
|
||||
Top = 423
|
||||
Height = 38
|
||||
Top = 426
|
||||
Width = 739
|
||||
OKButton.Name = 'OKButton'
|
||||
OKButton.Caption = '&Commit'
|
||||
@ -37,7 +37,7 @@ object SVNStatusFrm: TSVNStatusFrm
|
||||
end
|
||||
object SVNFileListView: TListView
|
||||
Left = 6
|
||||
Height = 266
|
||||
Height = 269
|
||||
Top = 151
|
||||
Width = 739
|
||||
Align = alClient
|
||||
@ -49,39 +49,39 @@ object SVNStatusFrm: TSVNStatusFrm
|
||||
Columns = <
|
||||
item
|
||||
AutoSize = True
|
||||
Width = 100
|
||||
Width = 10
|
||||
end
|
||||
item
|
||||
AutoSize = True
|
||||
Width = 100
|
||||
Width = 10
|
||||
end
|
||||
item
|
||||
AutoSize = True
|
||||
Width = 100
|
||||
Width = 10
|
||||
end
|
||||
item
|
||||
AutoSize = True
|
||||
Width = 100
|
||||
Width = 10
|
||||
end
|
||||
item
|
||||
AutoSize = True
|
||||
Width = 100
|
||||
Width = 10
|
||||
end
|
||||
item
|
||||
AutoSize = True
|
||||
Width = 100
|
||||
Width = 10
|
||||
end
|
||||
item
|
||||
AutoSize = True
|
||||
Width = 100
|
||||
Width = 10
|
||||
end
|
||||
item
|
||||
AutoSize = True
|
||||
Width = 100
|
||||
Width = 10
|
||||
end
|
||||
item
|
||||
AutoSize = True
|
||||
Width = 100
|
||||
Width = 636
|
||||
end>
|
||||
PopupMenu = PopupMenu1
|
||||
RowSelect = True
|
||||
@ -116,7 +116,7 @@ object SVNStatusFrm: TSVNStatusFrm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 72
|
||||
Top = 66
|
||||
Top = 69
|
||||
Width = 736
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Around = 3
|
||||
@ -127,9 +127,9 @@ object SVNStatusFrm: TSVNStatusFrm
|
||||
AnchorSideTop.Control = SVNCommitMsgHistoryComboBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 15
|
||||
Top = 48
|
||||
Width = 97
|
||||
Height = 16
|
||||
Top = 50
|
||||
Width = 105
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'CommitMsgLabel'
|
||||
ParentColor = False
|
||||
@ -138,20 +138,21 @@ object SVNStatusFrm: TSVNStatusFrm
|
||||
AnchorSideTop.Control = CommitMsgHistoryLabel
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 24
|
||||
Top = 18
|
||||
Height = 25
|
||||
Top = 19
|
||||
Width = 736
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Around = 3
|
||||
ItemHeight = 0
|
||||
OnChange = SVNCommitMsgHistoryComboBoxChange
|
||||
Style = csDropDownList
|
||||
TabOrder = 1
|
||||
end
|
||||
object CommitMsgHistoryLabel: TLabel
|
||||
Left = 6
|
||||
Height = 15
|
||||
Height = 16
|
||||
Top = 0
|
||||
Width = 137
|
||||
Width = 148
|
||||
Caption = 'CommitMsgHistoryLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
|
@ -91,7 +91,6 @@ begin
|
||||
if not Assigned(SVNStatusFrm) then
|
||||
SVNStatusFrm := TSVNStatusFrm.Create(nil);
|
||||
SVNStatusFrm.ChangeCursor(crHourGlass);
|
||||
|
||||
SVNStatusFrm.RepositoryPath:=ARepoPath;
|
||||
SVNStatusFrm.Show;
|
||||
end;
|
||||
@ -101,9 +100,10 @@ end;
|
||||
procedure TSVNStatusFrm.FormShow(Sender: TObject);
|
||||
begin
|
||||
Caption := Format('%s - %s...', [RepositoryPath, rsLazarusSVNCommit]);
|
||||
Application.QueueAsyncCall(@Initialize, 0);
|
||||
CommitMsgHistoryLabel.Caption:=rsCommitMsgHistory;
|
||||
CommitMsgLabel.Caption:=rsCommitMsg;
|
||||
// Application.QueueAsyncCall(@Initialize, 0);
|
||||
Initialize(0);
|
||||
end;
|
||||
|
||||
procedure TSVNStatusFrm.Initialize(Data: PtrInt);
|
||||
@ -204,7 +204,7 @@ procedure TSVNStatusFrm.OKButtonClick(Sender: TObject);
|
||||
var
|
||||
i: integer;
|
||||
CmdLine: string;
|
||||
StatusItem : PSVNStatusItem;
|
||||
StatusItem : TSVNStatusItem;
|
||||
FileName: string;
|
||||
begin
|
||||
UpdateCheckedStatus;
|
||||
@ -218,13 +218,12 @@ begin
|
||||
|
||||
for i := 0 to SVNStatus.List.Count - 1 do
|
||||
begin
|
||||
StatusItem := PSVNStatusItem(SVNStatus.List.Items[i]);
|
||||
|
||||
if StatusItem^.Checked then
|
||||
if pos(RepositoryPath,StatusItem^.Path) = 0 then
|
||||
CmdLine := CmdLine + ' "' + AppendPathDelim(RepositoryPath) + StatusItem^.Path + '"'
|
||||
StatusItem := SVNStatus.List[i];
|
||||
if StatusItem.Checked then
|
||||
if pos(RepositoryPath,StatusItem.Path) = 0 then
|
||||
CmdLine := CmdLine + ' "' + AppendPathDelim(RepositoryPath) + StatusItem.Path + '"'
|
||||
else
|
||||
CmdLine := CmdLine + ' "' + StatusItem^.Path + '"';
|
||||
CmdLine := CmdLine + ' "' + StatusItem.Path + '"';
|
||||
end;
|
||||
|
||||
FileName := GetTempFileName('','');
|
||||
@ -239,7 +238,7 @@ end;
|
||||
procedure TSVNStatusFrm.PatchButtonClick(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
StatusItem: PSVNStatusItem;
|
||||
StatusItem: TSVNStatusItem;
|
||||
FileNames: TStringList;
|
||||
begin
|
||||
UpdateCheckedStatus;
|
||||
@ -247,12 +246,12 @@ begin
|
||||
FileNames.Sorted := True;
|
||||
for i := 0 to SVNStatus.List.Count - 1 do
|
||||
begin
|
||||
StatusItem := PSVNStatusItem(SVNStatus.List.Items[i]);
|
||||
if StatusItem^.Checked then
|
||||
if pos(RepositoryPath,StatusItem^.Path) = 0 then
|
||||
FileNames.Append(AppendPathDelim(RepositoryPath) + StatusItem^.Path)
|
||||
StatusItem := SVNStatus.List.Items[i];
|
||||
if StatusItem.Checked then
|
||||
if pos(RepositoryPath,StatusItem.Path) = 0 then
|
||||
FileNames.Append(AppendPathDelim(RepositoryPath) + StatusItem.Path)
|
||||
else
|
||||
FileNames.Append(StatusItem^.Path);
|
||||
FileNames.Append(StatusItem.Path);
|
||||
end;
|
||||
ShowSVNDiffFrm('-r BASE', FileNames);
|
||||
end;
|
||||
@ -287,7 +286,8 @@ end;
|
||||
procedure TSVNStatusFrm.SVNCommitMsgHistoryComboBoxChange(Sender: TObject);
|
||||
begin
|
||||
with SVNCommitMsgHistoryComboBox do
|
||||
SVNCommitMsgMemo.Text := Items[ItemIndex];
|
||||
if ItemIndex > -1 then
|
||||
SVNCommitMsgMemo.Text := Items[ItemIndex];
|
||||
end;
|
||||
|
||||
procedure TSVNStatusFrm.SVNFileListViewColumnClick(Sender: TObject;
|
||||
@ -311,53 +311,42 @@ end;
|
||||
procedure TSVNStatusFrm.UpdateFilesListView;
|
||||
var
|
||||
i: integer;
|
||||
StatusItem : PSVNStatusItem;
|
||||
StatusItem : TSVNStatusItem;
|
||||
Path: string;
|
||||
begin
|
||||
SVNFileListView.BeginUpdate;
|
||||
SVNFileListView.Clear;
|
||||
|
||||
for i := 0 to SVNStatus.List.Count - 1 do
|
||||
begin
|
||||
|
||||
with SVNFileListView.Items.Add do
|
||||
begin
|
||||
StatusItem := PSVNStatusItem(SVNStatus.List.Items[i]);
|
||||
|
||||
StatusItem := SVNStatus.List.Items[i];
|
||||
//checkboxes
|
||||
Caption := '';
|
||||
Checked := StatusItem^.Checked;
|
||||
|
||||
Checked := StatusItem.Checked;
|
||||
//path
|
||||
Path := StatusItem^.Path;
|
||||
Path := StatusItem.Path;
|
||||
if pos(RepositoryPath, Path) = 1 then
|
||||
path := CreateRelativePath(path, RepositoryPath, false);
|
||||
SubItems.Add(Path);
|
||||
|
||||
//extension
|
||||
SubItems.Add(StatusItem^.Extension);
|
||||
|
||||
SubItems.Add(StatusItem.Extension);
|
||||
//file status
|
||||
SubItems.Add(StatusItem^.ItemStatus);
|
||||
|
||||
SubItems.Add(StatusItem.ItemStatus);
|
||||
//property status
|
||||
SubItems.Add(StatusItem^.PropStatus);
|
||||
|
||||
SubItems.Add(StatusItem.PropStatus);
|
||||
//check if file is versioned
|
||||
if (LowerCase(StatusItem^.ItemStatus) <> 'unversioned') and
|
||||
(LowerCase(StatusItem^.ItemStatus) <> 'added') then
|
||||
if (LowerCase(StatusItem.ItemStatus) <> 'unversioned') and
|
||||
(LowerCase(StatusItem.ItemStatus) <> 'added') then
|
||||
begin
|
||||
//revision
|
||||
SubItems.Add(IntToStr(StatusItem^.Revision));
|
||||
|
||||
SubItems.Add(IntToStr(StatusItem.Revision));
|
||||
//commit revision
|
||||
SubItems.Add(IntToStr(StatusItem^.CommitRevision));
|
||||
|
||||
SubItems.Add(IntToStr(StatusItem.CommitRevision));
|
||||
//author
|
||||
SubItems.Add(StatusItem^.Author);
|
||||
|
||||
SubItems.Add(StatusItem.Author);
|
||||
//date
|
||||
SubItems.Add(DateTimeToStr(StatusItem^.Date));
|
||||
SubItems.Add(DateTimeToStr(StatusItem.Date));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -368,7 +357,7 @@ procedure TSVNStatusFrm.ChangeCursor(ACursor: TCursor);
|
||||
begin
|
||||
Cursor := ACursor;
|
||||
SVNCommitMsgMemo.Cursor := ACursor;
|
||||
//SVNFileListView.Cursor := ACursor;
|
||||
SVNFileListView.Cursor := ACursor;
|
||||
Self.Cursor := ACursor;
|
||||
Application.ProcessMessages;
|
||||
end;
|
||||
@ -378,10 +367,8 @@ var
|
||||
i : Integer;
|
||||
begin
|
||||
for i := 0 to SVNFileListView.Items.Count - 1 do
|
||||
with SVNFileListView.Items[i] do
|
||||
begin
|
||||
PSVNStatusItem(SVNStatus.List.Items[Index])^.Checked := Checked;
|
||||
end;
|
||||
with SVNFileListView.Items[i] do
|
||||
SVNStatus.List[Index].Checked := Checked;
|
||||
end;
|
||||
|
||||
procedure TSVNStatusFrm.FormCreate(Sender: TObject);
|
||||
@ -414,14 +401,12 @@ begin
|
||||
|
||||
ImageList.AddLazarusResource('menu_svn_diff');
|
||||
ImageList.AddLazarusResource('menu_svn_revert');
|
||||
|
||||
try
|
||||
Config := GetIDEConfigStorage('lazsvnpkg.xml', true);
|
||||
|
||||
count := Config.GetValue('HistoryCount', 0);
|
||||
//limit to 100 entries
|
||||
if count > 100 then count := 100;
|
||||
|
||||
if count > 100 then
|
||||
count := 100;
|
||||
for i := count downto 0 do
|
||||
begin
|
||||
s := Config.GetValue('Msg' + IntToStr(i), '');
|
||||
@ -447,10 +432,8 @@ begin
|
||||
begin
|
||||
try
|
||||
Config := GetIDEConfigStorage('lazsvnpkg.xml', true);
|
||||
|
||||
count := Config.GetValue('HistoryCount', 0);
|
||||
Config.SetValue('HistoryCount', count + 1);
|
||||
|
||||
Config.SetValue('Msg' + IntToStr(count + 1), SVNCommitMsgMemo.Text);
|
||||
finally
|
||||
Config.Free;
|
||||
|
Loading…
Reference in New Issue
Block a user