Check-in [7183f7960c]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:New branch to completely rewrite the wizard, this time modularizing VCS Clients properly from the start, and also supporting threading.
Timelines: family | ancestors | descendants | both | feature/rewrite-multi-async
Files: files | file ages | folders
SHA1: 7183f7960cfcec6b66417dec2972bdebd8338259
User & Date: tinus 2016-02-14 14:11:28
Context
2016-02-14
16:09
We're going to be creating a DLL plugin instead of a BPL one. Renamed the old project. Created new plugin unit, added bitmap for splash and about screens. check-in: 7c16f12a17 user: tinus tags: feature/rewrite-multi-async
14:11
New branch to completely rewrite the wizard, this time modularizing VCS Clients properly from the start, and also supporting threading. check-in: 7183f7960c user: tinus tags: feature/rewrite-multi-async
2016-01-11
16:48
Comments. check-in: e1d5f80a24 user: tinus tags: trunk
Changes

Changes to todo.md.

111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139





























































  - `fossil sqlite3 "SELECT value FROM config WHERE name='project-name'"`
	(or `fossil info`, then extract the line starting with `project-name:`)

____________________________________________________________________________________________________

    TRepoInfo = class
    private
      FRepoClient: TRepoClient;
      FRoot: string;
      FLastCheckRepo: TDateTime;

      FBranch: string;
      FPending: Integer;
      FUntracked: Integer;
      FLastCheckWorkDir: TDateTime;

      FIncoming: Integer;
      FOutgoing: Integer;
      FLastCheckRemote: TDateTime;
    public
      property IsRepo: Boolean         read GetIsRepo;
      property Client: TRepoClient     read FRepoClient;
      property Root: string            read FRoot;
      property Branch: string;         read GetBranch;
      property Pending: Integer        read GetPending;
      property Untracked: Integer      read GetUntracked;
      property Incoming: Integer       read GetIncoming;
      property Outgoing: Integer       read GetOutgoing;
    end;




































































|













|







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
  - `fossil sqlite3 "SELECT value FROM config WHERE name='project-name'"`
	(or `fossil info`, then extract the line starting with `project-name:`)

____________________________________________________________________________________________________

    TRepoInfo = class
    private
      FVCSClient: TVCSClient;
      FRoot: string;
      FLastCheckRepo: TDateTime;

      FBranch: string;
      FPending: Integer;
      FUntracked: Integer;
      FLastCheckWorkDir: TDateTime;

      FIncoming: Integer;
      FOutgoing: Integer;
      FLastCheckRemote: TDateTime;
    public
      property IsRepo: Boolean         read GetIsRepo;
      property Client: TVCSClient      read FVCSClient;
      property Root: string            read FRoot;
      property Branch: string;         read GetBranch;
      property Pending: Integer        read GetPending;
      property Untracked: Integer      read GetUntracked;
      property Incoming: Integer       read GetIncoming;
      property Outgoing: Integer       read GetOutgoing;
    end;


____________________________________________________________________________________________________

TWizard.Create  // initialize UI part (add icons, create toolbar)
                // create repo cache
                // set up thread queue, timer and/or event handlers
OnTimer // for current repo, check if any timeout has elapsed; if so, add a task to check it.
        // if current repo is already being checked, only add it if the new task has more or other
        //   things to do.
OnFileSaved // for file's repo, reset the workdir status, so it'll have to be refreshed at the next
            //   trigger. Update the UI to reflect current status.
OnSwitchedModule    // if we selected a file in a new repo, update the UI to reflect that. Also
                    //   set up thread to refresh anything out of date for that repo.
ButtonRefresh       // refresh all info for the current module or project's repo.

____________________________________________________________________________________________________


GetFileRepo(AFile)
    AFile > FinalFile
    Map Final to FinalRepoPath in cache,
        else (via client) RepoPath > FinalRepoPath
    Get the repo-info for that FinalRepoPath
    Use the RepoPath when accessing the client

var
  FFileRepoPaths: TDictionary<string,string>;
  FRepoCache: TDictionary<string,TRepoInfo>;

function FindFileRepo(const AFilename: string): TRepoInfo;
var
  FinalFile, RepoRoot, FinalRepoRoot: string;
  VCSClient, Client: TVCSClient;
begin
  Result := Default(TRepoInfo);
  try
    FinalFile := FinalPathName(AFilename);
  except
    FinalFile := AFilename;
  end;
  VCSClient := nil;
  if not FFileRepoPaths.TryGetValue(FinalFile, {out}FinalRepoRoot) then begin
    for Client in VCSClients do begin
      if Client.IsInRepo(AFilename, {out} RepoRoot) then begin
        FinalRepoRoot := FinalPathName(RepoRoot);
        VCSClient := Client;
        Break;
      end;
    end;
    if VCSClient = nil then
      Exit;
  end;
  if not FRepoCache.TryGetValue(FinalRepoRoot, {out}Result) and Assigned(VCSClient) then begin
    Result := TRepoInfo.Create(RepoRoot, VCSClient);
    FRepoCache.Add(FinalRepoRoot, Result);
    FFileRepoPaths.AddOrSetValue(FinalFile, FinalRepoRoot);
  end;
end {FindFileRepo};