diff --git a/docs-master/Config.md b/docs-master/Config.md index 38887b3e2..aa149e9e8 100644 --- a/docs-master/Config.md +++ b/docs-master/Config.md @@ -666,6 +666,7 @@ keybinding: checkForUpdate: u recentRepos: allBranchesLogGraph: a + allBranchesLogGraphReverse: A files: commitChanges: c commitChangesWithoutHook: w diff --git a/docs-master/keybindings/Keybindings_en.md b/docs-master/keybindings/Keybindings_en.md index 2a25d1f62..827f6eb34 100644 --- a/docs-master/keybindings/Keybindings_en.md +++ b/docs-master/keybindings/Keybindings_en.md @@ -353,6 +353,7 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_ | `` u `` | Check for update | | | `` `` | Switch to a recent repo | | | `` a `` | Show/cycle all branch logs | | +| `` A `` | Show/cycle all branch logs (reverse) | | | `` 0 `` | Focus main view | | ## Sub-commits diff --git a/docs-master/keybindings/Keybindings_ja.md b/docs-master/keybindings/Keybindings_ja.md index 899493323..5b548d93f 100644 --- a/docs-master/keybindings/Keybindings_ja.md +++ b/docs-master/keybindings/Keybindings_ja.md @@ -185,6 +185,7 @@ _凡例:`<c-b>` はctrl+b、`<a-b>` はalt+b、`B` はshift+bを意味 | `` u `` | 更新を確認 | | | `` `` | 最近のリポジトリをチェックアウト | | | `` a `` | ブランチログの表示モードを順に切り替え | | +| `` A `` | Show/cycle all branch logs (reverse) | | | `` 0 `` | メインビューにフォーカス | | ## セカンダリ diff --git a/docs-master/keybindings/Keybindings_ko.md b/docs-master/keybindings/Keybindings_ko.md index e4e05b884..69d464fed 100644 --- a/docs-master/keybindings/Keybindings_ko.md +++ b/docs-master/keybindings/Keybindings_ko.md @@ -243,6 +243,7 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_ | `` u `` | 업데이트 확인 | | | `` `` | 최근에 사용한 저장소로 전환 | | | `` a `` | Show/cycle all branch logs | | +| `` A `` | Show/cycle all branch logs (reverse) | | | `` 0 `` | Focus main view | | ## 서브모듈 diff --git a/docs-master/keybindings/Keybindings_nl.md b/docs-master/keybindings/Keybindings_nl.md index e1d99162c..a95b88cb0 100644 --- a/docs-master/keybindings/Keybindings_nl.md +++ b/docs-master/keybindings/Keybindings_nl.md @@ -353,6 +353,7 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_ | `` u `` | Check voor updates | | | `` `` | Wissel naar een recente repo | | | `` a `` | Show/cycle all branch logs | | +| `` A `` | Show/cycle all branch logs (reverse) | | | `` 0 `` | Focus main view | | ## Sub-commits diff --git a/docs-master/keybindings/Keybindings_pl.md b/docs-master/keybindings/Keybindings_pl.md index 28c9f73a8..103cec454 100644 --- a/docs-master/keybindings/Keybindings_pl.md +++ b/docs-master/keybindings/Keybindings_pl.md @@ -332,6 +332,7 @@ _Legenda: `` oznacza ctrl+b, `` oznacza alt+b, `B` oznacza shift+b_ | `` u `` | Sprawdź aktualizacje | | | `` `` | Przełącz na ostatnie repozytorium | | | `` a `` | Show/cycle all branch logs | | +| `` A `` | Show/cycle all branch logs (reverse) | | | `` 0 `` | Focus main view | | ## Sub-commity diff --git a/docs-master/keybindings/Keybindings_pt.md b/docs-master/keybindings/Keybindings_pt.md index 217d477d4..56b805065 100644 --- a/docs-master/keybindings/Keybindings_pt.md +++ b/docs-master/keybindings/Keybindings_pt.md @@ -362,6 +362,7 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_ | `` u `` | Verificar atualização | | | `` `` | Mudar para um repositório recente | | | `` a `` | Mostrar/ciclo todos os logs de filiais | | +| `` A `` | Show/cycle all branch logs (reverse) | | | `` 0 `` | Focus main view | | ## Sub-commits diff --git a/docs-master/keybindings/Keybindings_ru.md b/docs-master/keybindings/Keybindings_ru.md index 20c0056b6..e9b48b6e6 100644 --- a/docs-master/keybindings/Keybindings_ru.md +++ b/docs-master/keybindings/Keybindings_ru.md @@ -319,6 +319,7 @@ _Связки клавиш_ | `` u `` | Проверить обновления | | | `` `` | Переключиться на последний репозиторий | | | `` a `` | Show/cycle all branch logs | | +| `` A `` | Show/cycle all branch logs (reverse) | | | `` 0 `` | Focus main view | | ## Теги diff --git a/docs-master/keybindings/Keybindings_zh-CN.md b/docs-master/keybindings/Keybindings_zh-CN.md index f1b32386a..eb22b3946 100644 --- a/docs-master/keybindings/Keybindings_zh-CN.md +++ b/docs-master/keybindings/Keybindings_zh-CN.md @@ -345,6 +345,7 @@ _图例:`` 意味着ctrl+b, `意味着Alt+b, `B` 意味着shift+b_ | `` u `` | 检查更新 | | | `` `` | 切换到最近的仓库 | | | `` a `` | 显示/循环所有分支日志 | | +| `` A `` | Show/cycle all branch logs (reverse) | | | `` 0 `` | 聚焦主视图 | | ## 确认面板 diff --git a/docs-master/keybindings/Keybindings_zh-TW.md b/docs-master/keybindings/Keybindings_zh-TW.md index c70915ad1..a5639e9b6 100644 --- a/docs-master/keybindings/Keybindings_zh-TW.md +++ b/docs-master/keybindings/Keybindings_zh-TW.md @@ -374,6 +374,7 @@ _說明:`` 表示 Ctrl+B、`` 表示 Alt+B,`B`表示 Shift+B | `` u `` | 檢查更新 | | | `` `` | 切換到最近使用的版本庫 | | | `` a `` | Show/cycle all branch logs | | +| `` A `` | Show/cycle all branch logs (reverse) | | | `` 0 `` | Focus main view | | ## 確認面板 diff --git a/pkg/commands/git_commands/branch.go b/pkg/commands/git_commands/branch.go index cd78a755b..a55278b5b 100644 --- a/pkg/commands/git_commands/branch.go +++ b/pkg/commands/git_commands/branch.go @@ -317,6 +317,12 @@ func (self *BranchCommands) RotateAllBranchesLogIdx() { self.allBranchesLogCmdIndex = (i + 1) % n } +func (self *BranchCommands) RotateAllBranchesLogIdxBackward() { + n := len(self.allBranchesLogCandidates()) + i := self.allBranchesLogCmdIndex + self.allBranchesLogCmdIndex = (i - 1 + n) % n +} + func (self *BranchCommands) GetAllBranchesLogIdxAndCount() (int, int) { n := len(self.allBranchesLogCandidates()) i := self.allBranchesLogCmdIndex diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go index abf591801..192d13843 100644 --- a/pkg/config/user_config.go +++ b/pkg/config/user_config.go @@ -493,9 +493,10 @@ type KeybindingUniversalConfig struct { } type KeybindingStatusConfig struct { - CheckForUpdate string `yaml:"checkForUpdate"` - RecentRepos string `yaml:"recentRepos"` - AllBranchesLogGraph string `yaml:"allBranchesLogGraph"` + CheckForUpdate string `yaml:"checkForUpdate"` + RecentRepos string `yaml:"recentRepos"` + AllBranchesLogGraph string `yaml:"allBranchesLogGraph"` + AllBranchesLogGraphReverse string `yaml:"allBranchesLogGraphReverse"` } type KeybindingFilesConfig struct { @@ -955,9 +956,10 @@ func GetDefaultConfig() *UserConfig { OpenDiffTool: "", }, Status: KeybindingStatusConfig{ - CheckForUpdate: "u", - RecentRepos: "", - AllBranchesLogGraph: "a", + CheckForUpdate: "u", + RecentRepos: "", + AllBranchesLogGraph: "a", + AllBranchesLogGraphReverse: "A", }, Files: KeybindingFilesConfig{ CommitChanges: "c", diff --git a/pkg/gui/controllers/status_controller.go b/pkg/gui/controllers/status_controller.go index d2c658095..377fd4994 100644 --- a/pkg/gui/controllers/status_controller.go +++ b/pkg/gui/controllers/status_controller.go @@ -63,6 +63,11 @@ func (self *StatusController) GetKeybindings(opts types.KeybindingsOpts) []*type Handler: func() error { self.switchToOrRotateAllBranchesLogs(); return nil }, Description: self.c.Tr.AllBranchesLogGraph, }, + { + Key: opts.GetKey(opts.Config.Status.AllBranchesLogGraphReverse), + Handler: func() error { self.switchToOrRotateAllBranchesLogsBackward(); return nil }, + Description: self.c.Tr.AllBranchesLogGraphReverse, + }, } return bindings @@ -206,6 +211,18 @@ func (self *StatusController) switchToOrRotateAllBranchesLogs() { self.showAllBranchLogs() } +// Switches to the all branches view, or, if already on that view, +// rotates to the previous command in the list, and then renders it. +func (self *StatusController) switchToOrRotateAllBranchesLogsBackward() { + // A bit of a hack to ensure we only rotate to the previous branch log command + // if we currently are looking at a branch log. Otherwise, we should just show + // the current index (if we are coming from the dashboard). + if self.c.Views().Main.Title != self.c.Tr.StatusTitle { + self.c.Git().Branch.RotateAllBranchesLogIdxBackward() + } + self.showAllBranchLogs() +} + func (self *StatusController) showDashboard() { versionStr := "master" version, err := types.ParseVersionNumber(self.c.GetConfig().GetVersion()) diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 0cb7d4a00..4c423c2bc 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -279,6 +279,7 @@ type TranslationSet struct { ConfirmQuit string SwitchRepo string AllBranchesLogGraph string + AllBranchesLogGraphReverse string UnsupportedGitService string CopyPullRequestURL string NoBranchOnRemote string @@ -1389,6 +1390,7 @@ func EnglishTranslationSet() *TranslationSet { ConfirmQuit: `Are you sure you want to quit?`, SwitchRepo: `Switch to a recent repo`, AllBranchesLogGraph: `Show/cycle all branch logs`, + AllBranchesLogGraphReverse: `Show/cycle all branch logs (reverse)`, UnsupportedGitService: `Unsupported git service`, CreatePullRequest: `Create pull request`, CopyPullRequestURL: `Copy pull request URL to clipboard`, diff --git a/pkg/integration/tests/status/log_cmd_status_panel_all_branches_log.go b/pkg/integration/tests/status/log_cmd_status_panel_all_branches_log.go index 828459426..defa2fa92 100644 --- a/pkg/integration/tests/status/log_cmd_status_panel_all_branches_log.go +++ b/pkg/integration/tests/status/log_cmd_status_panel_all_branches_log.go @@ -10,7 +10,11 @@ var LogCmdStatusPanelAllBranchesLog = NewIntegrationTest(NewIntegrationTestArgs{ ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { - config.GetUserConfig().Git.AllBranchesLogCmds = []string{`echo "view1"`, `echo "view2"`} + config.GetUserConfig().Git.AllBranchesLogCmds = []string{ + `echo "view1"`, + `echo "view2"`, + `echo "view3"`, + } config.GetUserConfig().Gui.StatusPanelView = "allBranchesLog" }, SetupRepo: func(shell *Shell) {}, @@ -25,14 +29,30 @@ var LogCmdStatusPanelAllBranchesLog = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Status(). Focus() - t.Views().Main().Content(Contains("view1").DoesNotContain("view2")) + t.Views().Main().Content(Contains("view1")) t.Views().Status(). Press(keys.Status.AllBranchesLogGraph) - t.Views().Main().Content(Contains("view2").DoesNotContain("view1")) + t.Views().Main().Content(Contains("view2")) t.Views().Status(). Press(keys.Status.AllBranchesLogGraph) - t.Views().Main().Content(Contains("view1").DoesNotContain("view2")) + t.Views().Main().Content(Contains("view3")) + + t.Views().Status(). + Press(keys.Status.AllBranchesLogGraph) + t.Views().Main().Content(Contains("view1")) + + t.Views().Status(). + Press(keys.Status.AllBranchesLogGraphReverse) + t.Views().Main().Content(Contains("view3")) + + t.Views().Status(). + Press(keys.Status.AllBranchesLogGraphReverse) + t.Views().Main().Content(Contains("view2")) + + t.Views().Status(). + Press(keys.Status.AllBranchesLogGraphReverse) + t.Views().Main().Content(Contains("view1")) }, }) diff --git a/schema-master/config.json b/schema-master/config.json index 0e880b066..54f9fa9ec 100644 --- a/schema-master/config.json +++ b/schema-master/config.json @@ -1204,6 +1204,10 @@ "allBranchesLogGraph": { "type": "string", "default": "a" + }, + "allBranchesLogGraphReverse": { + "type": "string", + "default": "A" } }, "additionalProperties": false,