~ubuntu-branches/ubuntu/saucy/lazarus/saucy

« back to all changes in this revision

Viewing changes to components/lazsvnpkg/svnclasses.pas

  • Committer: Package Import Robot
  • Author(s): Paul Gevers, Abou Al Montacir, Bart Martens, Paul Gevers
  • Date: 2013-06-08 14:12:17 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20130608141217-7k0cy9id8ifcnutc
Tags: 1.0.8+dfsg-1
[ Abou Al Montacir ]
* New upstream major release and multiple maintenace release offering many
  fixes and new features marking a new milestone for the Lazarus development
  and its stability level.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_fixes_branch
* LCL changes:
  - LCL is now a normal package.
      + Platform independent parts of the LCL are now in the package LCLBase
      + LCL is automatically recompiled when switching the target platform,
        unless pre-compiled binaries for this target are already installed.
      + No impact on existing projects.
      + Linker options needed by LCL are no more added to projects that do
        not use the LCL package.
  - Minor changes in LCL basic classes behaviour
      + TCustomForm.Create raises an exception if a form resource is not
        found.
      + TNotebook and TPage: a new implementation of these classes was added.
      + TDBNavigator: It is now possible to have focusable buttons by setting
        Options = [navFocusableButtons] and TabStop = True, useful for
        accessibility and for devices with neither mouse nor touch screen.
      + Names of TControlBorderSpacing.GetSideSpace and GetSpace were swapped
        and are now consistent. GetSideSpace = Around + GetSpace.
      + TForm.WindowState=wsFullscreen was added
      + TCanvas.TextFitInfo was added to calculate how many characters will
        fit into a specified Width. Useful for word-wrapping calculations.
      + TControl.GetColorResolvingParent and
        TControl.GetRGBColorResolvingParent were added, simplifying the work
        to obtain the final color of the control while resolving clDefault
        and the ParentColor.
      + LCLIntf.GetTextExtentExPoint now has a good default implementation
        which works in any platform not providing a specific implementation.
        However, Widgetset specific implementation is better, when available.
      + TTabControl was reorganized. Now it has the correct class hierarchy
        and inherits from TCustomTabControl as it should.
  - New unit in the LCL:
      + lazdialogs.pas: adds non-native versions of various native dialogs,
        for example TLazOpenDialog, TLazSaveDialog, TLazSelectDirectoryDialog.
        It is used by widgetsets which either do not have a native dialog, or
        do not wish to use it because it is limited. These dialogs can also be
        used by user applications directly.
      + lazdeviceapis.pas: offers an interface to more hardware devices such
        as the accelerometer, GPS, etc. See LazDeviceAPIs
      + lazcanvas.pas: provides a TFPImageCanvas descendent implementing
        drawing in a LCL-compatible way, but 100% in Pascal.
      + lazregions.pas. LazRegions is a wholly Pascal implementation of
        regions for canvas clipping, event clipping, finding in which control
        of a region tree one an event should reach, for drawing polygons, etc.
      + customdrawncontrols.pas, customdrawndrawers.pas,
        customdrawn_common.pas, customdrawn_android.pas and
        customdrawn_winxp.pas: are the Lazarus Custom Drawn Controls -controls
        which imitate the standard LCL ones, but with the difference that they
        are non-native and support skinning.
  - New APIs added to the LCL to improve support of accessibility software
    such as screen readers.
* IDE changes:
  - Many improvments.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/New_IDE_features_since#v1.0_.282012-08-29.29
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes#IDE_Changes
* Debugger / Editor changes:
  - Added pascal sources and breakpoints to the disassembler
  - Added threads dialog.
* Components changes:
  - TAChart: many fixes and new features
  - CodeTool: support Delphi style generics and new syntax extensions.
  - AggPas: removed to honor free licencing. (Closes: Bug#708695)
[Bart Martens]
* New debian/watch file fixing issues with upstream RC release.
[Abou Al Montacir]
* Avoid changing files in .pc hidden directory, these are used by quilt for
  internal purpose and could lead to surprises during build.
[Paul Gevers]
* Updated get-orig-source target and it compinion script orig-tar.sh so that they
  repack the source file, allowing bug 708695 to be fixed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
uses
26
26
  Classes, SysUtils, ComCtrls, FileUtil, LCLProc, Controls,
27
 
  XMLRead, DOM, Process, StdCtrls, Forms;
 
27
  XMLRead, DOM, Process, StdCtrls, Forms, contnrs, fgl;
28
28
 
29
29
resourcestring
30
30
  rsAction = 'Action';
46
46
  rsFileStatus = 'File status';
47
47
  rsIndexOutOfBoundsD = 'Index out of bounds (%d)';
48
48
  rsLazarusSVNCommit = 'LazarusSVN Commit';
49
 
  rsLazarusSVNDiff = '%s - LazarusSVN Diff...';
50
 
  rsLazarusSVNLog = '%s - LazarusSVN Log...';
51
 
  rsLazarusSVNUpdate = '%s - LazarusSVN Update...';
 
49
  rsLazarusSVNDiff = '%s - LazarusSVN Diff ...';
 
50
  rsLazarusSVNLog = '%s - LazarusSVN Log ...';
 
51
  rsLazarusSVNUpdate = '%s - LazarusSVN Update ...';
 
52
  rsCommitMsgHistory = 'Commit Message History';
 
53
  rsCommitMsg = 'Commit Message';
52
54
  rsMerged = 'Merged';
53
55
  rsMessage = 'Message';
54
56
  rsNoAuthor = '(no author)';
72
74
  rsSettings = 'Settings';
73
75
  rsSVNSettings = 'SVN settings';
74
76
  rsShowDiff = 'Show diff';
75
 
  rsShowDiffBase = 'Show diff of local changes';
76
 
  rsShowDiffPrev = 'Show diff against previous version';
77
 
  rsShowDiffHead = 'Show diff against HEAD';
78
 
  rsShowDiffCountRev = 'Show last X commits';
 
77
  rsShowDiffBase = 'Show Diff of Local Changes';
 
78
  rsShowDiffPrev = 'Show Diff Against Previous Version';
 
79
  rsShowDiffHead = 'Show Diff Against HEAD';
 
80
  rsShowDiffCountRev = 'Show Last X Commits';
79
81
  rsShowLog = 'Show log';
80
82
  rsSourceFileDoesNotBelongToTheProjectPleaseAddFirst = 'Source file does not '
81
83
    +'belong to the project. Please add first.';
94
96
  TStatusItemName = (siChecked, siPath, siExtension, siPropStatus, siItemStatus,
95
97
                     siRevision, siCommitRevision, siAuthor, siDate);
96
98
 
97
 
  PSVNStatusItem = ^TSVNStatusItem;
98
 
  TSVNStatusItem = record
 
99
//  PSVNStatusItem = ^TSVNStatusItem;
 
100
  TSVNStatusItem = class //record
99
101
    Checked: boolean;
100
102
    Path: string;
101
103
    Extension: string;
107
109
    Date: TDate;
108
110
  end;
109
111
 
 
112
  TSVNStatusList = specialize TFPGObjectList<TSVNStatusItem>;
 
113
 
110
114
  { TSVNStatus }
111
115
 
112
116
  TSVNStatus = class(TObject)
115
119
    FSortDirection: TSortDirection;
116
120
    FSortItem: TStatusItemName;
117
121
  public
118
 
    List: TFPList;
 
122
    List: TSVNStatusList; // TFPList;
119
123
 
120
124
    constructor Create(const ARepoPath: string; verbose: Boolean);
121
125
    destructor Destroy; override;
259
263
  Result := EncodeDate(y,m,d) + EncodeTime(h,n,s,0);
260
264
end;
261
265
 
262
 
function SortPathAscending(Item1, Item2: Pointer): Integer;
 
266
function SortPathAscending(const Item1, Item2: TSVNStatusItem): Integer;
263
267
begin
264
 
   Result := CompareText(PSVNStatusItem(Item1)^.Path, PSVNStatusItem(Item2)^.Path);
 
268
   Result := CompareText(Item1.Path, Item2.Path);
265
269
end;
266
270
 
267
 
function SortPathDescending(Item1, Item2: Pointer): Integer;
 
271
function SortPathDescending(const Item1, Item2: TSVNStatusItem): Integer;
268
272
begin
269
273
  Result := -SortPathAscending(Item1, Item2);
270
274
end;
271
275
 
272
 
function SortSelectedAscending(Item1, Item2: Pointer): Integer;
 
276
function SortSelectedAscending(const Item1, Item2: TSVNStatusItem): Integer;
273
277
begin
274
 
   if PSVNStatusItem(Item1)^.Checked > PSVNStatusItem(Item2)^.Checked then
 
278
   if Item1.Checked > Item2.Checked then
275
279
     Result := 1
276
280
   else
277
 
     if PSVNStatusItem(Item1)^.Checked = PSVNStatusItem(Item2)^.Checked then
 
281
     if Item1.Checked = Item2.Checked then
278
282
       Result := SortPathDescending(Item1, Item2)
279
283
     else
280
284
       Result := -1;
281
285
end;
282
286
 
283
 
function SortSelectedDescending(Item1, Item2: Pointer): Integer;
 
287
function SortSelectedDescending(const Item1, Item2: TSVNStatusItem): Integer;
284
288
begin
285
289
  Result := -SortSelectedAscending(Item1, Item2);
286
290
end;
287
291
 
288
 
function SortExtensionAscending(Item1, Item2: Pointer): Integer;
 
292
function SortExtensionAscending(const Item1, Item2: TSVNStatusItem): Integer;
289
293
begin
290
 
   Result := CompareText(PSVNStatusItem(Item1)^.Extension, PSVNStatusItem(Item2)^.Extension);
 
294
   Result := CompareText(Item1.Extension, Item2.Extension);
291
295
end;
292
296
 
293
 
function SortExtensionDescending(Item1, Item2: Pointer): Integer;
 
297
function SortExtensionDescending(const Item1, Item2: TSVNStatusItem): Integer;
294
298
begin
295
299
  Result := -SortExtensionAscending(Item1, Item2);
296
300
end;
297
301
 
298
 
function SortItemStatusAscending(Item1, Item2: Pointer): Integer;
 
302
function SortItemStatusAscending(const Item1, Item2: TSVNStatusItem): Integer;
299
303
begin
300
 
   Result := CompareText(PSVNStatusItem(Item1)^.ItemStatus, PSVNStatusItem(Item2)^.ItemStatus);
 
304
   Result := CompareText(Item1.ItemStatus, Item2.ItemStatus);
301
305
end;
302
306
 
303
 
function SortItemStatusDescending(Item1, Item2: Pointer): Integer;
 
307
function SortItemStatusDescending(const Item1, Item2: TSVNStatusItem): Integer;
304
308
begin
305
309
  Result := -SortItemStatusAscending(Item1, Item2);
306
310
end;
307
311
 
308
 
function SortPropStatusAscending(Item1, Item2: Pointer): Integer;
 
312
function SortPropStatusAscending(const Item1, Item2: TSVNStatusItem): Integer;
309
313
begin
310
 
   Result := CompareText(PSVNStatusItem(Item1)^.PropStatus, PSVNStatusItem(Item2)^.PropStatus);
 
314
   Result := CompareText(Item1.PropStatus, Item2.PropStatus);
311
315
end;
312
316
 
313
 
function SortPropStatusDescending(Item1, Item2: Pointer): Integer;
 
317
function SortPropStatusDescending(const Item1, Item2: TSVNStatusItem): Integer;
314
318
begin
315
319
  Result := -SortPropStatusAscending(Item1, Item2);
316
320
end;
317
321
 
318
 
function SortPropertyAuthorAscending(Item1, Item2: Pointer): Integer;
 
322
function SortPropertyAuthorAscending(const Item1, Item2: TSVNStatusItem): Integer;
319
323
begin
320
 
   Result := CompareText(PSVNStatusItem(Item1)^.Author, PSVNStatusItem(Item2)^.Author);
 
324
   Result := CompareText(Item1.Author, Item2.Author);
321
325
end;
322
326
 
323
 
function SortPropertyAuthorDescending(Item1, Item2: Pointer): Integer;
 
327
function SortPropertyAuthorDescending(const Item1, Item2: TSVNStatusItem): Integer;
324
328
begin
325
329
  Result := -SortPropertyAuthorAscending(Item1, Item2);
326
330
end;
327
331
 
328
 
function SortPropertyRevisionAscending(Item1, Item2: Pointer): Integer;
 
332
function SortPropertyRevisionAscending(const Item1, Item2: TSVNStatusItem): Integer;
329
333
begin
330
 
   if PSVNStatusItem(Item1)^.Revision > PSVNStatusItem(Item2)^.Revision then
 
334
   if Item1.Revision > Item2.Revision then
331
335
     Result := 1
332
336
   else
333
 
     if PSVNStatusItem(Item1)^.Revision = PSVNStatusItem(Item2)^.Revision then
 
337
     if Item1.Revision = Item2.Revision then
334
338
       Result := 0
335
339
     else
336
340
       Result := -1;
337
341
end;
338
342
 
339
 
function SortPropertyRevisionDescending(Item1, Item2: Pointer): Integer;
 
343
function SortPropertyRevisionDescending(const Item1, Item2: TSVNStatusItem): Integer;
340
344
begin
341
345
  Result := -SortPropertyRevisionAscending(Item1, Item2);
342
346
end;
343
347
 
344
 
function SortPropertyCommitRevisionAscending(Item1, Item2: Pointer): Integer;
 
348
function SortPropertyCommitRevisionAscending(const Item1, Item2: TSVNStatusItem): Integer;
345
349
begin
346
 
   if PSVNStatusItem(Item1)^.CommitRevision > PSVNStatusItem(Item2)^.CommitRevision then
 
350
   if Item1.CommitRevision > Item2.CommitRevision then
347
351
     Result := 1
348
352
   else
349
 
     if PSVNStatusItem(Item1)^.CommitRevision = PSVNStatusItem(Item2)^.CommitRevision then
 
353
     if Item1.CommitRevision = Item2.CommitRevision then
350
354
       Result := 0
351
355
     else
352
356
       Result := -1;
353
357
end;
354
358
 
355
 
function SortPropertyCommitRevisionDescending(Item1, Item2: Pointer): Integer;
 
359
function SortPropertyCommitRevisionDescending(const Item1, Item2: TSVNStatusItem): Integer;
356
360
begin
357
361
  Result := -SortPropertyCommitRevisionAscending(Item1, Item2);
358
362
end;
359
363
 
360
 
function SortPropertyDateAscending(Item1, Item2: Pointer): Integer;
 
364
function SortPropertyDateAscending(const Item1, Item2: TSVNStatusItem): Integer;
361
365
begin
362
 
   if PSVNStatusItem(Item1)^.Date > PSVNStatusItem(Item2)^.Date then
 
366
   if Item1.Date > Item2.Date then
363
367
     Result := 1
364
368
   else
365
 
     if PSVNStatusItem(Item1)^.Date = PSVNStatusItem(Item2)^.Date then
 
369
     if Item1.Date = Item2.Date then
366
370
       Result := 0
367
371
     else
368
372
       Result := -1;
369
373
end;
370
374
 
371
 
function SortPropertyDateDescending(Item1, Item2: Pointer): Integer;
 
375
function SortPropertyDateDescending(const Item1, Item2: TSVNStatusItem): Integer;
372
376
begin
373
377
  Result := -SortPropertyDateAscending(Item1, Item2);
374
378
end;
434
438
  Doc: TXMLDocument;
435
439
  F: LongInt;
436
440
  i: integer;
437
 
  ListItem: PSVNStatusItem;
 
441
  ListItem: TSVNStatusItem;
438
442
  Node: TDOMNode;
439
443
  NodeName: string;
440
444
  NodeValue: string;
441
445
  Path: string;
442
446
  SubNode: TDOMNode;
443
447
begin
444
 
  List := TFPList.Create;
 
448
  List := TSVNStatusList.Create;
445
449
  RepositoryPath := ARepoPath;
446
450
 
447
451
  if Verbose then
458
462
 
459
463
  repeat
460
464
    SubNode := Node;
461
 
 
462
 
    New(ListItem);
463
 
 
464
465
    Path := SubNode.Attributes.Item[0].NodeValue;
465
466
    debugln('TSVNStatus.Create ' + Path);
466
 
 
467
467
    F:=FileGetAttr(Path);
468
 
    If F<>-1 then
469
 
      If (F and faDirectory)=0 then
470
 
      begin
471
 
        //initialize author (anonymous repositories)
472
 
        ListItem^.Author := rsNoAuthor;
473
 
 
474
 
        //path
475
 
        ListItem^.Path := Path;
476
 
 
477
 
        //Extension
478
 
        ListItem^.Extension:=ExtractFileExt(Path);
479
 
 
480
 
        //get the wc-status attributes
481
 
        ListItem^.ItemStatus:='';
482
 
        ListItem^.Checked:=False;
483
 
        ListItem^.PropStatus:='';
484
 
        for i := 0 to SubNode.ChildNodes.Item[0].Attributes.Length -1 do
485
 
        begin
486
 
          NodeName := SubNode.ChildNodes.Item[0].Attributes.Item[i].NodeName;
487
 
          NodeValue := SubNode.ChildNodes.Item[0].Attributes.Item[i].NodeValue;
488
 
 
489
 
          if NodeName = 'item' then
490
 
          begin
491
 
            //ItemStatus
492
 
            ListItem^.ItemStatus := LowerCase(NodeValue);
493
 
 
494
 
            //Checked
495
 
            ListItem^.Checked:=(NodeValue<>'unversioned') and (NodeValue<>'normal');
496
 
          end;
497
 
 
498
 
          if NodeName = 'props' then
499
 
            //PropStatus
500
 
            ListItem^.PropStatus := NodeValue;
501
 
 
502
 
          if NodeName = 'revision' then
503
 
            //Revision
504
 
            ListItem^.Revision := StrToInt(NodeValue);
505
 
        end;
506
 
 
507
 
        //get the commit attributes
508
 
        SubNode := SubNode.ChildNodes.Item[0].ChildNodes.Item[0];
509
 
        if Assigned(SubNode) then
510
 
        begin
511
 
          //CommitRevision
512
 
          ListItem^.CommitRevision:=StrToInt(SubNode.Attributes.Item[0].NodeValue);
513
 
 
514
 
          for i := 0 to SubNode.ChildNodes.Count - 1 do
515
 
          begin
516
 
            ActNode := SubNode.ChildNodes.Item[i];
517
 
 
518
 
            if Assigned(ActNode) then
519
 
            begin
520
 
              NodeName := ActNode.NodeName;
521
 
 
522
 
              //Author
523
 
              if NodeName = 'author' then
524
 
                ListItem^.Author := ActNode.FirstChild.NodeValue;
525
 
 
526
 
              //Date
527
 
              if NodeName = 'date' then
528
 
                ListItem^.Date := ISO8601ToDateTime(ActNode.FirstChild.NodeValue);
529
 
            end;
530
 
          end;
531
 
        end;
532
 
 
533
 
        List.Add(ListItem);
534
 
      end;
535
 
 
 
468
    If (F<>-1) and ((F and faDirectory)=0) then
 
469
    begin
 
470
      ListItem := TSVNStatusItem.Create;
 
471
      //initialize author (anonymous repositories)
 
472
      ListItem.Author := rsNoAuthor;
 
473
      //path
 
474
      ListItem.Path := Path;
 
475
      //Extension
 
476
      ListItem.Extension:=ExtractFileExt(Path);
 
477
      //get the wc-status attributes
 
478
      ListItem.ItemStatus:='';
 
479
      ListItem.Checked:=False;
 
480
      ListItem.PropStatus:='';
 
481
      for i := 0 to SubNode.ChildNodes.Item[0].Attributes.Length -1 do
 
482
      begin
 
483
        NodeName := SubNode.ChildNodes.Item[0].Attributes.Item[i].NodeName;
 
484
        NodeValue := SubNode.ChildNodes.Item[0].Attributes.Item[i].NodeValue;
 
485
        if NodeName = 'item' then
 
486
        begin
 
487
          //ItemStatus
 
488
          ListItem.ItemStatus := LowerCase(NodeValue);
 
489
          //Checked
 
490
          ListItem.Checked:=(NodeValue<>'unversioned') and (NodeValue<>'normal');
 
491
        end;
 
492
        if NodeName = 'props' then
 
493
          //PropStatus
 
494
          ListItem.PropStatus := NodeValue;
 
495
        if NodeName = 'revision' then
 
496
          //Revision
 
497
          ListItem.Revision := StrToInt(NodeValue);
 
498
      end;
 
499
      //get the commit attributes
 
500
      SubNode := SubNode.ChildNodes.Item[0].ChildNodes.Item[0];
 
501
      if Assigned(SubNode) then
 
502
      begin
 
503
        //CommitRevision
 
504
        ListItem.CommitRevision:=StrToInt(SubNode.Attributes.Item[0].NodeValue);
 
505
        for i := 0 to SubNode.ChildNodes.Count - 1 do
 
506
        begin
 
507
          ActNode := SubNode.ChildNodes.Item[i];
 
508
          if Assigned(ActNode) then
 
509
          begin
 
510
            NodeName := ActNode.NodeName;
 
511
            //Author
 
512
            if NodeName = 'author' then
 
513
              ListItem.Author := ActNode.FirstChild.NodeValue;
 
514
            //Date
 
515
            if NodeName = 'date' then
 
516
              ListItem.Date := ISO8601ToDateTime(ActNode.FirstChild.NodeValue);
 
517
          end;
 
518
        end;
 
519
      end;
 
520
      List.Add(ListItem);
 
521
    end;
536
522
    Node := Node.NextSibling;
537
523
  until not Assigned(Node);
538
524
  Doc.Free;
541
527
destructor TSVNStatus.Destroy;
542
528
begin
543
529
  List.Free;
544
 
 
545
530
  inherited Destroy;
546
531
end;
547
532