Changeset 15 for trunk/Units/UVCS.pas


Ignore:
Timestamp:
Jul 13, 2015, 11:44:23 AM (9 years ago)
Author:
chronos
Message:
  • Added: Support for reading file status from working copy.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Units/UVCS.pas

    r13 r15  
    2525  TLogList = class(TObjectList)
    2626
     27  end;
     28
     29  TFileStatusState = (fssNonVersioned, fssAdded, fssRemoved, fssModified, fssNotModified);
     30
     31  { TFileStatus }
     32
     33  TFileStatus = class
     34    FileName: string;
     35    Version: string;
     36    Author: string;
     37    Time: TDateTime;
     38    State: TFileStatusState;
     39    procedure Assign(Source: TFileStatus);
     40  end;
     41
     42  { TFileStatusList }
     43
     44  TFileStatusList = class(TObjectList)
     45    function SearchByName(Name: string): TFileStatus;
    2746  end;
    2847
     
    5473    procedure Remove(FileName: string); virtual;
    5574    procedure GetLog(FileName: string; Log: TLogList); virtual;
     75    procedure GetStatus(FileName: string; Status: TFileStatusList); virtual;
    5676    constructor Create;
    5777    destructor Destroy; override;
     
    7696function URLFromDirectory(DirName: string; Relative: Boolean): string;
    7797
     98const
     99  FileStatusStateText: array[TFileStatusState] of string = ('Not versioned',
     100    'Added', 'Removed', 'Modified', 'Normal');
     101
    78102implementation
    79103
     
    86110  if Relative then Result := GetCurrentDirUTF8 + DirectorySeparator + Result;
    87111  Result := 'file:///' + StringReplace(Result, DirectorySeparator, '/', [rfReplaceAll]);
     112end;
     113
     114{ TFileStatus }
     115
     116procedure TFileStatus.Assign(Source: TFileStatus);
     117begin
     118  FileName := Source.FileName;
     119  Version := Source.Version;
     120  Time := Source.Time;
     121  Author := Source.Author;
     122  State := Source.State;
     123end;
     124
     125{ TFileStatusList }
     126
     127function TFileStatusList.SearchByName(Name: string): TFileStatus;
     128var
     129  I: Integer;
     130begin
     131  I := 0;
     132  while (I < Count) and (TFileStatus(Items[I]).FileName <> Name) do Inc(I);
     133  if I < Count then Result := TFileStatus(Items[I])
     134    else Result := nil;
    88135end;
    89136
     
    222269end;
    223270
     271procedure TWorkingCopy.GetStatus(FileName: string; Status: TFileStatusList);
     272begin
     273  Status.Clear;
     274end;
     275
    224276constructor TWorkingCopy.Create;
    225277begin
Note: See TracChangeset for help on using the changeset viewer.