diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dfa421e..e4168804 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v3.9.7-dev + +## Enhancements + +- Project menu, git: add the last commit as additional infor attached to the list of branches. (#53) + # v3.9.6 ## Enhancements diff --git a/src/u_main.lfm b/src/u_main.lfm index 95a3d8e1..b025e119 100644 --- a/src/u_main.lfm +++ b/src/u_main.lfm @@ -11,7 +11,6 @@ object MainForm: TMainForm OnDropFiles = FormDropFiles OnResize = FormResize ShowHint = True - LCLVersion = '2.0.8.0' object mainMenu: TMainMenu top = 1 object MenuItem1: TMenuItem diff --git a/src/u_main.pas b/src/u_main.pas index f115f913..65a2125b 100644 --- a/src/u_main.pas +++ b/src/u_main.pas @@ -2803,6 +2803,17 @@ begin end; end; +{procedure TMainForm.ActionsExecute(AAction: TBasicAction; var Handled: Boolean); +var + HintAction: TCustomHintAction absolute AAction; +begin + if (AAction is TCustomHintAction) and + string(HintAction.Hint).StartsWith() then + begin + // here attempt to show TMenuItem.Hint can be detected + end; +end;} + procedure TMainForm.actLayoutResetExecute(Sender: TObject); begin InitDocking(true); @@ -4162,6 +4173,7 @@ procedure TMainForm.actProjGitBranchesUpdExecute(Sender: TObject); var p: TProcess; r: TStringList; + c: TStringList; i: integer; m: TMenuItem; a: boolean; @@ -4176,6 +4188,7 @@ begin exit; p := TProcess.Create(nil); r := TStringList.Create; + c := TStringList.create; try p.Executable := exeFullName('git' + exeExt); if p.Executable.fileExists then @@ -4195,6 +4208,11 @@ begin mnuGitBranch.Add(m); mnuGitBranch.AddSeparator; end; + c.LoadFromStream(p.Stderr); + for i := 0 to c.Count-1 do + fMsgs.message(c[i], fProj, amcProj, amkAuto); + p.Parameters.Clear(); + p.Parameters.AddStrings(['log', '--format=%B', '-n', '1', '']); for i:= 0 to r.Count-1 do begin m := TMenuItem.Create(mnuGitBranch); @@ -4208,16 +4226,21 @@ begin m.Checked:= true; end else m.Caption:= Trim(r[i][1..r[i].length]); + c.Clear; + p.Parameters.Delete(4); + p.Parameters.AddStrings(m.Caption); + p.Execute(); + processOutputToStrings(p, c); + while p.Running do ; + if not c.Count.equals(0) then + m.caption := m.caption + ' [last commit: ' + c[0] + ' ]'; mnuGitBranch.Add(m); end; - r.Clear; - r.LoadFromStream(p.Stderr); - for i := 0 to r.Count-1 do - fMsgs.message(r[i], fProj, amcProj, amkAuto); end; finally p.Free; r.Free; + c.Free; end; end;