Check-in [9c85a796dd]

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

Overview
Comment:Minor code optimizations.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9c85a796dd09b8c4ab193da4c37135d88cdfd663
User & Date: tinus 2015-11-25 19:17:28
Context
2015-11-25
21:42
Clicking on the VCS info menu item now opens a terminal in the current file's directory, and runs the VCS tool. Sync changesets are now limited to 9; if there are more, indicate this with a + sign. check-in: a512ab16be user: tinus tags: trunk
20:06
Start a branch to move all background checks to a separate thread, so the IDE is not impacted (as much). check-in: 768730b774 user: tinus tags: feature/async-refresh
19:17
Minor code optimizations. check-in: 9c85a796dd user: tinus tags: trunk
18:47
Position branches popup correctly. When no branches, show that. check-in: 6648d07b6c user: tinus tags: trunk
Changes

Changes to src/VCSInfoMenuWzrd.pas.

1
2
3
4
5
6
7
8
9
10
11
12
13
...
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709


710
711
712
713
714
715
716
717
718
719
720


721
722
723
724
725
726
727
unit VCSInfoMenuWzrd;

interface
uses
  System.Generics.Collections,
  Vcl.ComCtrls, Vcl.Controls, Vcl.ActnList, Vcl.Buttons, Vcl.Menus,
  ToolsAPI;


type
  TRepoInfo = record
    Root: string;
    RepoType: string;
................................................................................
end;

procedure TVCSInfoWizard.actInfoMenuPopup(Sender: TObject);
var
  Menu: TPopupMenu;
  Item: TMenuItem;
  Button: TToolButton;
  Lines: TStringList;
begin
  try
    Menu := Sender as TPopupMenu;
    if Menu.Owner is TToolButton then begin
      Item := Menu.Items.Items[Menu.Items.Count - 1];
      Button := TToolButton(Menu.Owner);
      case IndexStr(Button.Hint, ['Mercurial', 'Fossil']) of
        0: begin // hg
          Item.ImageIndex := FImgMercurial;
          Lines := TStringList.Create;
          try
            ExecuteCmd('thg version', Lines.Append);
            if Lines.Count > 0 then
              Item.Caption := Lines[0];
          finally
            Lines.Free;
          end;


        end;
        1: begin // fossil
          Item.ImageIndex := FImgFossil;
          Lines := TStringList.Create;
          try
            ExecuteCmd('fossil version', Lines.Append);
            if Lines.Count > 0 then
              Item.Caption := Lines[0].Replace('This is ', '');
          finally
            Lines.Free;
          end;


        end;
        else begin
          Item.ImageIndex := FImgIcon;
          Item.Caption := GetCurrentVersion;
        end;
      end{case};
    end;





|







 







|









<
<
|
<
<
<
<
<
>
>



<
<
|
<
<
<
<
<
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
...
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701


702





703
704
705
706
707


708





709
710
711
712
713
714
715
716
717
unit VCSInfoMenuWzrd;

interface
uses
  System.Generics.Collections,
  Vcl.ComCtrls, Vcl.Controls, Vcl.ActnList, Vcl.Menus,
  ToolsAPI;


type
  TRepoInfo = record
    Root: string;
    RepoType: string;
................................................................................
end;

procedure TVCSInfoWizard.actInfoMenuPopup(Sender: TObject);
var
  Menu: TPopupMenu;
  Item: TMenuItem;
  Button: TToolButton;
  Output: string;
begin
  try
    Menu := Sender as TPopupMenu;
    if Menu.Owner is TToolButton then begin
      Item := Menu.Items.Items[Menu.Items.Count - 1];
      Button := TToolButton(Menu.Owner);
      case IndexStr(Button.Hint, ['Mercurial', 'Fossil']) of
        0: begin // hg
          Item.ImageIndex := FImgMercurial;


          ExecuteCmd('thg version', Output);





          if Output <> '' then
            Item.Caption := Output.Split([#13#10, #10, #13], 1, TStringSplitOptions.ExcludeEmpty)[0];
        end;
        1: begin // fossil
          Item.ImageIndex := FImgFossil;


          ExecuteCmd('fossil version', Output);





          if Output <> '' then
            Item.Caption := Output.Replace('This is f', 'F').TrimRight;
        end;
        else begin
          Item.ImageIndex := FImgIcon;
          Item.Caption := GetCurrentVersion;
        end;
      end{case};
    end;