diff --git a/README.md b/README.md index b6320e9..0200a73 100644 --- a/README.md +++ b/README.md @@ -265,8 +265,8 @@ The _Commits_ view lists all of the commits on the current branch, and additiona - the current branch status — shows the upstream status of the current branch - **Publish <current branch> to <remote>** — shown when the current branch has not been published to a remote - **Up to date with <remote>** — shown when the current branch is up to date with the upstream remote - - **Changes to push to <remote>** — lists of all the files changed in the unpublished commits when the current branch has (unpublished) commits that waiting to be pushed to the upstream remote - **Changes to pull from <remote>** — lists all of the commits waiting to be pulled when the current branch has commits that are waiting to be pulled from the upstream remote + - **Changes to push to <remote>** — lists of all the files changed in the unpublished commits when the current branch has (unpublished) commits that waiting to be pushed to the upstream remote - any associated pull request — shows any opened pull request associated with the current branch --- @@ -289,23 +289,24 @@ The Repositories view lists opened Git repositories, and additionally provides, - _Red dot_ — has changes un-pulled (behind) - _Yellow dot_ — both unpublished and un-pulled changes - a branch comparison tool (**Compare <current branch> with <branch, tag, or ref>**) — [optionally](#repositories-view-settings- 'Jump to the Repositories view settings') shows a comparison of the current branch (or working tree) to a user-selected reference -- the current branch status — shows the upstream status of the current branch (if not up to date) - - **Publish <current branch> to remote** — shown when the current branch has not been published to a remote - - **Changes to push to <remote>** — lists of all the files changed in the unpublished commits when the current branch has (unpublished) commits that waiting to be pushed to the upstream remote - - **Changes to pull from <remote>** — lists all of the commits waiting to be pulled when the current branch has commits that are waiting to be pulled from the upstream remote -- any associated pull request — shows any opened pull request associated with the current branch - **Behind** — lists the commits that are missing from the current branch (i.e. behind) but exist in the selected reference - **# files changed** — lists all of the files changed between the compared references - **Ahead** — lists the commits that the current branch has (i.e. ahead) but are missing in the selected reference - **# files changed** — lists all of the files changed between the compared references -- the changed files — lists all of the files changed by the unpublished (unpushed) commits and [optionally](#repositories-view-settings- 'Jump to the Repositories view settings') any working tree changes -- the current branch commits — similar to the [Commits view](#commits-view- 'Commits view') -- the local branches — similar to the [Branches view](#branches-view- 'Branches view') -- the contributors — similar to the [Contributors view](#contributors-view- 'Contributors view') -- any incoming activity (experimental) — lists the command, branch (if available), and date of recent incoming activity (merges and pulls) to your local repository -- the remotes and remote branches — similar to the [Remotes view](#remotes-view- 'Remotes view') -- the stashes — similar to the [Stashes view](#stashes-view- 'Stashes view') -- the tags — similar to the [Tags view](#tags-view- 'Tags view') +- **# files changed** — [optionally](#repositories-view-settings- 'Jump to the Repositories view settings') lists all of the files changed in the working tree +- the current branch status — [optionally](#repositories-view-settings- 'Jump to the Repositories view settings') shows the upstream status of the current branch + - **Publish <current branch> to remote** — shown when the current branch has not been published to a remote + - **Up to date with <remote>** — shown when the current branch is up to date with the upstream remote + - **Changes to pull from <remote>** — lists all of the unpulled commits and all of the files changed in them, when the current branch has commits that are waiting to be pulled from the upstream remote + - **Changes to push to <remote>** — lists of all the unpublished commits and all of the files changed in them, when the current branch has commits that waiting to be pushed to the upstream remote +- any associated pull request — [optionally](#repositories-view-settings- 'Jump to the Repositories view settings') shows any opened pull request associated with the current branch +- **Commits** — [optionally](#repositories-view-settings- 'Jump to the Repositories view settings') shows the current branch commits, similar to the [Commits view](#commits-view- 'Commits view') +- **Branches** — [optionally](#repositories-view-settings- 'Jump to the Repositories view settings') shows the local branches, similar to the [Branches view](#branches-view- 'Branches view') +- **Remotes** — [optionally](#repositories-view-settings- 'Jump to the Repositories view settings') shows the remotes and remote branches, similar to the [Remotes view](#remotes-view- 'Remotes view') +- **Stashes** — [optionally](#repositories-view-settings- 'Jump to the Repositories view settings') shows the stashes, similar to the [Stashes view](#stashes-view- 'Stashes view') +- **Tags** — [optionally](#repositories-view-settings- 'Jump to the Repositories view settings') shows the tags, similar to the [Tags view](#tags-view- 'Tags view') +- **Contributors** — [optionally](#repositories-view-settings- 'Jump to the Repositories view settings') shows the contributors, similar to the [Contributors view](#contributors-view- 'Contributors view') +- **Incoming Activity** (experimental) — [optionally](#repositories-view-settings- 'Jump to the Repositories view settings') shows any incoming activity, which lists the command, branch (if available), and date of recent incoming activity (merges and pulls) to your local repository --- @@ -727,19 +728,28 @@ See also [View Settings](#view-settings- 'Jump to the View settings') See also [View Settings](#view-settings- 'Jump to the View settings') -| Name | Description | -| ------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `gitlens.views.repositories.avatars` | Specifies whether to show avatar images instead of commit (or status) icons in the _Repositories_ view | -| `gitlens.views.repositories.autoRefresh` | Specifies whether to automatically refresh the _Repositories_ view when the repository or the file system changes | -| `gitlens.views.repositories.autoReveal` | Specifies whether to automatically reveal repositories in the _Repositories_ view when opening files | -| `gitlens.views.repositories.branches.layout` | Specifies how the _Repositories_ view will display branches

`list` - displays branches as a list
`tree` - displays branches as a tree when branch names contain slashes `/` | -| `gitlens.views.repositories.compact` | Specifies whether to show the _Repositories_ view in a compact display density | -| `gitlens.views.repositories.enabled` | Specifies whether to show the _Repositories_ view | -| `gitlens.views.repositories.files.compact` | Specifies whether to compact (flatten) unnecessary file nesting in the _Repositories_ view. Only applies when `gitlens.views.repositories.files.layout` is set to `tree` or `auto` | -| `gitlens.views.repositories.files.layout` | Specifies how the _Repositories_ view will display files

`auto` - automatically switches between displaying files as a `tree` or `list` based on the `gitlens.views.repositories.files.threshold` value and the number of files at each nesting level
`list` - displays files as a list
`tree` - displays files as a tree | -| `gitlens.views.repositories.files.threshold` | Specifies when to switch between displaying files as a `tree` or `list` based on the number of files in a nesting level in the _Repositories_ view. Only applies when `gitlens.views.repositories.files.layout` is set to `auto` | -| `gitlens.views.repositories.includeWorkingTree` | Specifies whether to include working tree file status for each repository in the _Repositories_ view | -| `gitlens.views.repositories.showBranchComparison` | Specifies whether to show a comparison of a user-selected reference (branch, tag. etc) to the current branch or the working tree in the _Repositories_ view | +| Name | Description | +| ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `gitlens.views.repositories.avatars` | Specifies whether to show avatar images instead of commit (or status) icons in the _Repositories_ view | +| `gitlens.views.repositories.autoRefresh` | Specifies whether to automatically refresh the _Repositories_ view when the repository or the file system changes | +| `gitlens.views.repositories.autoReveal` | Specifies whether to automatically reveal repositories in the _Repositories_ view when opening files | +| `gitlens.views.repositories.branches.layout` | Specifies how the _Repositories_ view will display branches

`list` - displays branches as a list
`tree` - displays branches as a tree when branch names contain slashes `/` | +| `gitlens.views.repositories.branches.showBranchComparison` | Specifies whether to show a comparison of the branch with a user-selected reference (branch, tag. etc) under _Branches_ in the _Repositories_ view view | +| `gitlens.views.repositories.compact` | Specifies whether to show the _Repositories_ view in a compact display density | +| `gitlens.views.repositories.enabled` | Specifies whether to show the _Repositories_ view | +| `gitlens.views.repositories.files.compact` | Specifies whether to compact (flatten) unnecessary file nesting in the _Repositories_ view. Only applies when `gitlens.views.repositories.files.layout` is set to `tree` or `auto` | +| `gitlens.views.repositories.files.layout` | Specifies how the _Repositories_ view will display files

`auto` - automatically switches between displaying files as a `tree` or `list` based on the `gitlens.views.repositories.files.threshold` value and the number of files at each nesting level
`list` - displays files as a list
`tree` - displays files as a tree | +| `gitlens.views.repositories.files.threshold` | Specifies when to switch between displaying files as a `tree` or `list` based on the number of files in a nesting level in the _Repositories_ view. Only applies when `gitlens.views.repositories.files.layout` is set to `auto` | +| `gitlens.views.repositories.includeWorkingTree` | Specifies whether to include working tree file status for each repository in the _Repositories_ view | +| `gitlens.views.repositories.showBranchComparison` | Specifies whether to show a comparison of a user-selected reference (branch, tag. etc) to the current branch or the working tree in the _Repositories_ view | +| `gitlens.views.repositories.showBranches` | Specifies whether to show the branches for each repository in the _Repositories_ view | +| `itlens.views.repositories.showCommits` | Specifies whether to show the commits on the current branch for each repository in the _Repositories_ view | +| `gitlens.views.repositories.showContributors` | Specifies whether to show the contributors for each repository in the _Repositories_ view | +| `gitlens.views.repositories.showIncomingActivity` | Specifies whether to show the experimental incoming activity for each repository in the _Repositories_ view | +| `gitlens.views.repositories.showRemotes` | Specifies whether to show the remotes for each repository in the _Repositories_ view | +| `gitlens.views.repositories.showStashes` | Specifies whether to show the stashes for each repository in the _Repositories_ view | +| `gitlens.views.repositories.showTags` | Specifies whether to show the tags for each repository in the _Repositories_ view | +| `gitlens.views.repositories.showUpstreamStatus` | Specifies whether to show the upstream status of the current branch for each repository in the _Repositories_ view | ## File History View Settings [#](#file-history-view-settings- 'File History View Settings') diff --git a/package.json b/package.json index b892dad..46392c7 100644 --- a/package.json +++ b/package.json @@ -2021,6 +2021,27 @@ "markdownDescription": "Specifies how the _Repositories_ view will display branches", "scope": "window" }, + "gitlens.views.repositories.branches.showBranchComparison": { + "anyOf": [ + { + "enum": [ + false + ] + }, + { + "type": "string", + "enum": [ + "branch" + ], + "enumDescriptions": [ + "Compares the branch with a user-selected reference" + ] + } + ], + "default": "branch", + "markdownDescription": "Specifies whether to show a comparison of the branch with a user-selected reference (branch, tag. etc) under _Branches_ in the _Repositories_ view", + "scope": "window" + }, "gitlens.views.repositories.compact": { "type": "boolean", "default": false, @@ -2108,6 +2129,54 @@ "markdownDescription": "Specifies whether to show a comparison of the current branch or the working tree with a user-selected reference (branch, tag. etc) in the _Repositories_ view", "scope": "window" }, + "gitlens.views.repositories.showBranches": { + "type": "boolean", + "default": true, + "markdownDescription": "Specifies whether to show the branches for each repository in the _Repositories_ view", + "scope": "window" + }, + "gitlens.views.repositories.showCommits": { + "type": "boolean", + "default": true, + "markdownDescription": "Specifies whether to show the commits on the current branch for each repository in the _Repositories_ view", + "scope": "window" + }, + "gitlens.views.repositories.showContributors": { + "type": "boolean", + "default": true, + "markdownDescription": "Specifies whether to show the contributors for each repository in the _Repositories_ view", + "scope": "window" + }, + "gitlens.views.repositories.showIncomingActivity": { + "type": "boolean", + "default": false, + "markdownDescription": "Specifies whether to show the experimental incoming activity for each repository in the _Repositories_ view", + "scope": "window" + }, + "gitlens.views.repositories.showRemotes": { + "type": "boolean", + "default": true, + "markdownDescription": "Specifies whether to show the remotes for each repository in the _Repositories_ view", + "scope": "window" + }, + "gitlens.views.repositories.showStashes": { + "type": "boolean", + "default": true, + "markdownDescription": "Specifies whether to show the stashes for each repository in the _Repositories_ view", + "scope": "window" + }, + "gitlens.views.repositories.showTags": { + "type": "boolean", + "default": true, + "markdownDescription": "Specifies whether to show the tags for each repository in the _Repositories_ view", + "scope": "window" + }, + "gitlens.views.repositories.showUpstreamStatus": { + "type": "boolean", + "default": true, + "markdownDescription": "Specifies whether to show the upstream status of the current branch for each repository in the _Repositories_ view", + "scope": "window" + }, "gitlens.views.searchAndCompare.avatars": { "type": "boolean", "default": true, @@ -3930,12 +3999,12 @@ }, { "command": "gitlens.views.branches.setShowBranchComparisonOn", - "title": "Show Branch Comparison", + "title": "Show Branch Comparisons", "category": "GitLens" }, { "command": "gitlens.views.branches.setShowBranchComparisonOff", - "title": "Hide Branch Comparison", + "title": "Hide Branch Comparisons", "category": "GitLens" }, { @@ -4315,6 +4384,91 @@ "category": "GitLens" }, { + "command": "gitlens.views.repositories.setBranchesShowBranchComparisonOn", + "title": "Show Branch Comparisons", + "category": "GitLens" + }, + { + "command": "gitlens.views.repositories.setBranchesShowBranchComparisonOff", + "title": "Hide Branch Comparisons", + "category": "GitLens" + }, + { + "command": "gitlens.views.repositories.setShowBranchesOn", + "title": "Show Branches", + "category": "GitLens" + }, + { + "command": "gitlens.views.repositories.setShowBranchesOff", + "title": "Hide Branches", + "category": "GitLens" + }, + { + "command": "gitlens.views.repositories.setShowCommitsOn", + "title": "Show Commits", + "category": "GitLens" + }, + { + "command": "gitlens.views.repositories.setShowCommitsOff", + "title": "Hide Commits", + "category": "GitLens" + }, + { + "command": "gitlens.views.repositories.setShowContributorsOn", + "title": "Show Contributors", + "category": "GitLens" + }, + { + "command": "gitlens.views.repositories.setShowContributorsOff", + "title": "Hide Contributors", + "category": "GitLens" + }, + { + "command": "gitlens.views.repositories.setShowRemotesOn", + "title": "Show Remotes", + "category": "GitLens" + }, + { + "command": "gitlens.views.repositories.setShowRemotesOff", + "title": "Hide Remotes", + "category": "GitLens" + }, + { + "command": "gitlens.views.repositories.setShowStashesOn", + "title": "Show Stashes", + "category": "GitLens" + }, + { + "command": "gitlens.views.repositories.setShowStashesOff", + "title": "Hide Stashes", + "category": "GitLens" + }, + { + "command": "gitlens.views.repositories.setShowTagsOn", + "title": "Show Tags", + "category": "GitLens" + }, + { + "command": "gitlens.views.repositories.setShowTagsOff", + "title": "Hide Tags", + "category": "GitLens" + }, + { + "command": "gitlens.views.repositories.setShowUpstreamStatusOn", + "title": "Show Current Branch Status", + "category": "GitLens" + }, + { + "command": "gitlens.views.repositories.setShowUpstreamStatusOff", + "title": "Hide Current Branch Status", + "category": "GitLens" + }, + { + "command": "gitlens.views.repositories.setShowSectionOff", + "title": "Hide", + "category": "GitLens" + }, + { "command": "gitlens.views.searchAndCompare.clear", "title": "Clear Results", "category": "GitLens", @@ -5603,6 +5757,74 @@ "when": "false" }, { + "command": "gitlens.views.repositories.setBranchesShowBranchComparisonOn", + "when": "false" + }, + { + "command": "gitlens.views.repositories.setBranchesShowBranchComparisonOff", + "when": "false" + }, + { + "command": "gitlens.views.repositories.setShowBranchesOn", + "when": "false" + }, + { + "command": "gitlens.views.repositories.setShowBranchesOff", + "when": "false" + }, + { + "command": "gitlens.views.repositories.setShowCommitsOn", + "when": "false" + }, + { + "command": "gitlens.views.repositories.setShowCommitsOff", + "when": "false" + }, + { + "command": "gitlens.views.repositories.setShowContributorsOn", + "when": "false" + }, + { + "command": "gitlens.views.repositories.setShowContributorsOff", + "when": "false" + }, + { + "command": "gitlens.views.repositories.setShowRemotesOn", + "when": "false" + }, + { + "command": "gitlens.views.repositories.setShowRemotesOff", + "when": "false" + }, + { + "command": "gitlens.views.repositories.setShowStashesOn", + "when": "false" + }, + { + "command": "gitlens.views.repositories.setShowStashesOff", + "when": "false" + }, + { + "command": "gitlens.views.repositories.setShowTagsOn", + "when": "false" + }, + { + "command": "gitlens.views.repositories.setShowTagsOff", + "when": "false" + }, + { + "command": "gitlens.views.repositories.setShowUpstreamStatusOn", + "when": "false" + }, + { + "command": "gitlens.views.repositories.setShowUpstreamStatusOff", + "when": "false" + }, + { + "command": "gitlens.views.repositories.setShowSectionOff", + "when": "false" + }, + { "command": "gitlens.views.searchAndCompare.clear", "when": "false" }, @@ -6211,12 +6433,12 @@ { "command": "gitlens.showRepositoriesView", "when": "view =~ /^gitlens\\.views\\.commits/ && !config.gitlens.views.repositories.enabled", - "group": "8_gitlens@0" + "group": "8_gitlens_toggles@0" }, { "command": "gitlens.hideRepositoriesView", "when": "view =~ /^gitlens\\.views\\.commits/ && config.gitlens.views.repositories.enabled", - "group": "8_gitlens@0" + "group": "8_gitlens_toggles@0" }, { "command": "gitlens.views.addAuthors", @@ -6321,12 +6543,12 @@ { "command": "gitlens.showLineHistoryView", "when": "view =~ /^gitlens\\.views\\.fileHistory/ && !config.gitlens.views.lineHistory.enabled", - "group": "8_gitlens@0" + "group": "8_gitlens_toggles@0" }, { "command": "gitlens.hideLineHistoryView", "when": "view =~ /^gitlens\\.views\\.fileHistory/ && config.gitlens.views.lineHistory.enabled", - "group": "8_gitlens@0" + "group": "8_gitlens_toggles@0" }, { "command": "gitlens.views.lineHistory.setEditorFollowingOn", @@ -6459,6 +6681,11 @@ "group": "3_gitlens@0" }, { + "submenu": "gitlens/view/repositories/sections", + "when": "view =~ /^gitlens\\.views\\.repositories/", + "group": "4_gitlens@1" + }, + { "command": "gitlens.views.repositories.setShowAvatarsOn", "when": "view =~ /^gitlens\\.views\\.repositories/ && !config.gitlens.views.repositories.avatars", "group": "5_gitlens@0" @@ -6469,16 +6696,6 @@ "group": "5_gitlens@0" }, { - "command": "gitlens.views.repositories.setShowBranchComparisonOn", - "when": "view =~ /^gitlens\\.views\\.repositories/ && !config.gitlens.views.repositories.showBranchComparison", - "group": "5_gitlens@1" - }, - { - "command": "gitlens.views.repositories.setShowBranchComparisonOff", - "when": "view =~ /^gitlens\\.views\\.repositories/ && config.gitlens.views.repositories.showBranchComparison", - "group": "5_gitlens@1" - }, - { "submenu": "gitlens/view/searchAndCompare/new", "when": "view =~ /^gitlens\\.views\\.searchAndCompare\\b/", "group": "navigation@10" @@ -6713,6 +6930,16 @@ "alt": "gitlens.copyRemoteBranchesUrl" }, { + "command": "gitlens.views.repositories.setBranchesShowBranchComparisonOn", + "when": "view =~ /^gitlens\\.views\\.repositories/ && viewItem =~ /gitlens:branches\\b/ && !config.gitlens.views.repositories.branches.showBranchComparison", + "group": "8_gitlens_toggles@1" + }, + { + "command": "gitlens.views.repositories.setBranchesShowBranchComparisonOff", + "when": "view =~ /^gitlens\\.views\\.repositories/ && viewItem =~ /gitlens:branches\\b/ && config.gitlens.views.repositories.branches.showBranchComparison", + "group": "8_gitlens_toggles@1" + }, + { "command": "gitlens.views.switchToBranch", "when": "!gitlens:readonly && viewItem =~ /gitlens:branch\\b(?!.*?\\b\\+current\\b)/", "group": "inline@7" @@ -7161,6 +7388,16 @@ "group": "inline@1" }, { + "command": "gitlens.views.repositories.setBranchesLayoutToList", + "when": "viewItem =~ /gitlens:remotes\\b/ && config.gitlens.views.repositories.branches.layout == tree", + "group": "inline@50" + }, + { + "command": "gitlens.views.repositories.setBranchesLayoutToTree", + "when": "viewItem =~ /gitlens:remotes\\b/ && config.gitlens.views.repositories.branches.layout == list", + "group": "inline@50" + }, + { "command": "gitlens.views.addRemote", "when": "!gitlens:readonly && viewItem =~ /gitlens:remotes\\b/", "group": "1_gitlens_actions@1" @@ -7451,12 +7688,22 @@ { "command": "gitlens.views.branches.setShowBranchComparisonOff", "when": "view =~ /gitlens\\.views\\.branches\\b/ && viewItem =~ /gitlens:compare:branch\\b/", - "group": "8_gitlens@1" + "group": "8_gitlens_toggles@1" }, { "command": "gitlens.views.commits.setShowBranchComparisonOff", "when": "view =~ /gitlens\\.views\\.commits\\b/ && viewItem =~ /gitlens:compare:branch\\b/", - "group": "8_gitlens@1" + "group": "8_gitlens_toggles@1" + }, + { + "command": "gitlens.views.repositories.setBranchesShowBranchComparisonOff", + "when": "view =~ /gitlens\\.views\\.repositories\\b/ && viewItem =~ /gitlens:compare:branch(?!.*?\\b\\+root\\b)\\b/", + "group": "8_gitlens_toggles@1" + }, + { + "command": "gitlens.views.repositories.setShowSectionOff", + "when": "view =~ /gitlens\\.views\\.repositories\\b/ && viewItem =~ /gitlens:(compare:branch(?=.*?\\b\\+root\\b)|branches|branch(?=.*?\\b\\+commits\\b)|reflog|remotes|stashes|status:upstream|tags)\\b/", + "group": "8_gitlens_toggles@99" }, { "command": "gitlens.views.clearNode", @@ -7981,6 +8228,88 @@ "group": "1_gitlens@2" } ], + "gitlens/view/repositories/sections": [ + { + "command": "gitlens.views.repositories.setShowBranchComparisonOn", + "when": "!config.gitlens.views.repositories.showBranchComparison", + "group": "1_gitlens@0" + }, + { + "command": "gitlens.views.repositories.setShowBranchComparisonOff", + "when": "config.gitlens.views.repositories.showBranchComparison", + "group": "1_gitlens@0" + }, + { + "command": "gitlens.views.repositories.setShowUpstreamStatusOn", + "when": "!config.gitlens.views.repositories.showUpstreamStatus", + "group": "1_gitlens@1" + }, + { + "command": "gitlens.views.repositories.setShowUpstreamStatusOff", + "when": "config.gitlens.views.repositories.showUpstreamStatus", + "group": "1_gitlens@1" + }, + { + "command": "gitlens.views.repositories.setShowCommitsOn", + "when": "!config.gitlens.views.repositories.showCommits", + "group": "2_gitlens@2" + }, + { + "command": "gitlens.views.repositories.setShowCommitsOff", + "when": "config.gitlens.views.repositories.showCommits", + "group": "2_gitlens@2" + }, + { + "command": "gitlens.views.repositories.setShowBranchesOn", + "when": "!config.gitlens.views.repositories.showBranches", + "group": "2_gitlens@3" + }, + { + "command": "gitlens.views.repositories.setShowBranchesOff", + "when": "config.gitlens.views.repositories.showBranches", + "group": "2_gitlens@3" + }, + { + "command": "gitlens.views.repositories.setShowRemotesOn", + "when": "!config.gitlens.views.repositories.showRemotes", + "group": "2_gitlens@4" + }, + { + "command": "gitlens.views.repositories.setShowRemotesOff", + "when": "config.gitlens.views.repositories.showRemotes", + "group": "2_gitlens@4" + }, + { + "command": "gitlens.views.repositories.setShowStashesOn", + "when": "!config.gitlens.views.repositories.showStashes", + "group": "2_gitlens@5" + }, + { + "command": "gitlens.views.repositories.setShowStashesOff", + "when": "config.gitlens.views.repositories.showStashes", + "group": "2_gitlens@5" + }, + { + "command": "gitlens.views.repositories.setShowTagsOn", + "when": "!config.gitlens.views.repositories.showTags", + "group": "2_gitlens@6" + }, + { + "command": "gitlens.views.repositories.setShowTagsOff", + "when": "config.gitlens.views.repositories.showTags", + "group": "2_gitlens@6" + }, + { + "command": "gitlens.views.repositories.setShowContributorsOn", + "when": "!config.gitlens.views.repositories.showContributors", + "group": "2_gitlens@7" + }, + { + "command": "gitlens.views.repositories.setShowContributorsOff", + "when": "config.gitlens.views.repositories.showContributors", + "group": "2_gitlens@7" + } + ], "gitlens/view/searchAndCompare/new": [ { "command": "gitlens.views.searchAndCompare.searchCommits", @@ -8052,6 +8381,10 @@ "label": "Open Changes" }, { + "id": "gitlens/view/repositories/sections", + "label": "Sections" + }, + { "id": "gitlens/view/searchAndCompare/new", "label": "New Search or Compare", "icon": "$(add)" diff --git a/src/config.ts b/src/config.ts index 41d6056..bead2d0 100644 --- a/src/config.ts +++ b/src/config.ts @@ -485,7 +485,7 @@ export interface BranchesViewConfig { showForBranches: boolean; showForCommits: boolean; }; - showBranchComparison: false | ViewShowBranchComparison; + showBranchComparison: false | ViewShowBranchComparison.Branch; } export interface CommitsViewConfig { @@ -537,6 +537,7 @@ export interface RepositoriesViewConfig { avatars: boolean; branches: { layout: ViewBranchesLayout; + showBranchComparison: false | ViewShowBranchComparison.Branch; }; compact: boolean; enabled: boolean; @@ -548,6 +549,14 @@ export interface RepositoriesViewConfig { showForCommits: boolean; }; showBranchComparison: false | ViewShowBranchComparison; + showBranches: boolean; + showCommits: boolean; + showContributors: boolean; + showIncomingActivity: boolean; + showRemotes: boolean; + showStashes: boolean; + showTags: boolean; + showUpstreamStatus: boolean; } export interface SearchAndCompareViewConfig { diff --git a/src/views/branchesView.ts b/src/views/branchesView.ts index b3f9960..024b37f 100644 --- a/src/views/branchesView.ts +++ b/src/views/branchesView.ts @@ -323,7 +323,7 @@ export class BranchesView extends ViewBase 'views', this.configKey, 'showBranchComparison', - enabled ? ViewShowBranchComparison.Working : false, + enabled ? ViewShowBranchComparison.Branch : false, ); } diff --git a/src/views/commitsView.ts b/src/views/commitsView.ts index 0270370..ddc3c68 100644 --- a/src/views/commitsView.ts +++ b/src/views/commitsView.ts @@ -4,6 +4,7 @@ import { commands, ConfigurationChangeEvent, Disposable, + MarkdownString, ProgressLocation, TreeItem, TreeItemCollapsibleState, @@ -88,9 +89,9 @@ export class CommitsRepositoryNode extends RepositoryFolderNode { this.splatted = false; - const name = this.label; - let tooltip = `Branch ${this.branch.getNameWithoutRemote()}${this.current ? ' (current)' : ''}`; - let iconSuffix = ''; + let tooltip = `${ + this.current ? 'Current branch' : 'Branch' + } $(git-branch) ${this.branch.getNameWithoutRemote()}`; let contextValue: string = ContextValues.Branch; if (this.current) { @@ -231,8 +242,13 @@ export class BranchNode if (this.branch.tracking) { contextValue += '+tracking'; } + if (this.options.showAsCommits) { + contextValue += '+commits'; + } + let color: ThemeColor | undefined; let description; + let iconSuffix = ''; if (!this.branch.remote) { if (this.branch.tracking != null) { let arrows = GlyphChars.Dash; @@ -262,27 +278,36 @@ export class BranchNode } } - description = `${this.branch.getTrackingStatus({ suffix: `${GlyphChars.Space} ` })}${arrows}${ - GlyphChars.Space - } ${this.branch.tracking}`; + description = this.options.showAsCommits + ? `${this.branch.getTrackingStatus({ + suffix: Strings.pad(GlyphChars.Dot, 1, 1), + })}${this.branch.getNameWithoutRemote()}${Strings.pad(arrows, 2, 2)}${this.branch.tracking}` + : `${this.branch.getTrackingStatus({ suffix: `${GlyphChars.Space} ` })}${arrows}${ + GlyphChars.Space + } ${this.branch.tracking}`; tooltip += ` is ${this.branch.getTrackingStatus({ - empty: `up to date with ${this.branch.tracking}${ + empty: `up to date with $(git-branch) ${this.branch.tracking}${ remote?.provider?.name ? ` on ${remote.provider.name}` : '' }`, expand: true, + icons: true, separator: ', ', - suffix: ` ${this.branch.tracking}${remote?.provider?.name ? ` on ${remote.provider.name}` : ''}`, + suffix: ` $(git-branch) ${this.branch.tracking}${ + remote?.provider?.name ? ` on ${remote.provider.name}` : '' + }`, })}`; if (this.branch.state.ahead || this.branch.state.behind) { - if (this.branch.state.behind) { - contextValue += '+behind'; - iconSuffix = '-red'; - } if (this.branch.state.ahead) { contextValue += '+ahead'; - iconSuffix = this.branch.state.behind ? '-yellow' : '-green'; + color = new ThemeColor('gitlens.viewChangesToPushIconColor'); + iconSuffix = '-green'; + } + if (this.branch.state.behind) { + contextValue += '+behind'; + color = new ThemeColor('gitlens.viewChangesToPullIconColor'); + iconSuffix = this.branch.state.ahead ? '-yellow' : '-red'; } } } else { @@ -295,28 +320,30 @@ export class BranchNode } } - if (this.branch.date !== undefined) { + if (this.branch.date != null) { description = `${description ? `${description}${Strings.pad(GlyphChars.Dot, 2, 2)}` : ''}${ this.branch.formattedDate }`; - tooltip += `\nLast commit ${this.branch.formatDateFromNow()} (${this.branch.formatDate( + tooltip += `\n\nLast commit ${this.branch.formatDateFromNow()} (${this.branch.formatDate( BranchDateFormatting.dateFormat, )})`; } const item = new TreeItem( - `${this.options.showCurrent && this.current ? `${GlyphChars.Check} ${GlyphChars.Space}` : ''}${name}`, + `${this.options.showCurrent && this.current ? Strings.pad(GlyphChars.Check, 0, 2) : ''}${this.label}`, this.options.expanded ? TreeItemCollapsibleState.Expanded : TreeItemCollapsibleState.Collapsed, ); + item.iconPath = this.options.showAsCommits + ? new ThemeIcon('git-commit', color) + : { + dark: Container.context.asAbsolutePath(`images/dark/icon-branch${iconSuffix}.svg`), + light: Container.context.asAbsolutePath(`images/light/icon-branch${iconSuffix}.svg`), + }; item.contextValue = contextValue; item.description = description; - item.iconPath = { - dark: Container.context.asAbsolutePath(`images/dark/icon-branch${iconSuffix}.svg`), - light: Container.context.asAbsolutePath(`images/light/icon-branch${iconSuffix}.svg`), - }; item.id = this.id; - item.tooltip = tooltip; + item.tooltip = new MarkdownString(tooltip, true); return item; } @@ -345,12 +372,10 @@ export class BranchNode private _log: GitLog | undefined; private async getLog() { if (this._log == null) { - // Ensure we always show all unpublished commits (and the upstream tip) - let limit = - this.limit ?? - (this.view instanceof CommitsView ? this.view.config.pageItemLimit : this.view.config.defaultItemLimit); + let limit = this.limit ?? (this.root ? this.view.config.pageItemLimit : this.view.config.defaultItemLimit); + // Try to show more commits if they are unpublished if (limit !== 0 && this.branch.state.ahead > limit) { - limit = this.branch.state.ahead + 1; + limit = Math.min(this.branch.state.ahead + 1, limit * 2); } this._log = await Container.git.getLog(this.uri.repoPath!, { diff --git a/src/views/nodes/branchTrackingStatusFilesNode.ts b/src/views/nodes/branchTrackingStatusFilesNode.ts index dc27367..7f52de7 100644 --- a/src/views/nodes/branchTrackingStatusFilesNode.ts +++ b/src/views/nodes/branchTrackingStatusFilesNode.ts @@ -27,6 +27,7 @@ export class BranchTrackingStatusFilesNode extends ViewNode { public readonly branch: GitBranch, public readonly status: Required, public readonly direction: 'ahead' | 'behind', + // Specifies that the node is shown as a root private readonly root: boolean = false, ) { super(GitUri.fromRepoPath(status.repoPath), view, parent); diff --git a/src/views/nodes/branchTrackingStatusNode.ts b/src/views/nodes/branchTrackingStatusNode.ts index 85cee50..961e7cc 100644 --- a/src/views/nodes/branchTrackingStatusNode.ts +++ b/src/views/nodes/branchTrackingStatusNode.ts @@ -1,5 +1,5 @@ 'use strict'; -import { ThemeColor, ThemeIcon, TreeItem, TreeItemCollapsibleState, window } from 'vscode'; +import { MarkdownString, ThemeColor, ThemeIcon, TreeItem, TreeItemCollapsibleState, window } from 'vscode'; import { BranchNode } from './branchNode'; import { BranchTrackingStatusFilesNode } from './branchTrackingStatusFilesNode'; import { CommitNode } from './commitNode'; @@ -8,8 +8,7 @@ import { Container } from '../../container'; import { GitBranch, GitLog, GitRemote, GitRevision, GitTrackingState } from '../../git/git'; import { GitUri } from '../../git/gitUri'; import { insertDateMarkers } from './helpers'; -import { RepositoriesView } from '../repositoriesView'; -import { Dates, debug, gate, Iterables, memoize, Strings } from '../../system'; +import { Dates, debug, gate, Iterables, Strings } from '../../system'; import { ViewsWithFiles } from '../viewBase'; import { ContextValues, PageableViewNode, ViewNode } from './viewNode'; @@ -32,16 +31,25 @@ export class BranchTrackingStatusNode extends ViewNode implement return `${BranchNode.getId(repoPath, name, root)}${this.key}(${upstream ?? ''}):${upstreamType}`; } + private readonly options: { + showAheadCommits?: boolean; + }; + constructor( view: ViewsWithFiles, parent: ViewNode, public readonly branch: GitBranch, public readonly status: BranchTrackingStatus, public readonly upstreamType: 'ahead' | 'behind' | 'same' | 'none', - // Specifies that the node is shown as a root and not nested under the branches node + // Specifies that the node is shown as a root public readonly root: boolean = false, + options?: { + showAheadCommits?: boolean; + }, ) { super(GitUri.fromRepoPath(status.repoPath), view, parent); + + this.options = { showAheadCommits: false, ...options }; } get id(): string { @@ -80,7 +88,15 @@ export class BranchTrackingStatusNode extends ViewNode implement } const children = []; - if (!this.isReposView && this.status.upstream && this.upstreamType === 'ahead' && this.status.state.ahead > 0) { + + let showFiles = true; + if ( + !this.options.showAheadCommits && + this.upstreamType === 'ahead' && + this.status.upstream && + this.status.state.ahead > 0 + ) { + showFiles = false; // TODO@eamodio fix this children.push( ...(await new BranchTrackingStatusFilesNode( @@ -109,13 +125,28 @@ export class BranchTrackingStatusNode extends ViewNode implement } } + if (showFiles) { + children.splice( + 0, + 0, + new BranchTrackingStatusFilesNode( + this.view, + this, + this.branch, + this.status as Required, + this.upstreamType, + this.root, + ), + ); + } + return children; } async getTreeItem(): Promise { let lastFetched = 0; - if (this.root && !this.isReposView && this.upstreamType !== 'none') { + if (this.upstreamType !== 'none') { const repo = await Container.git.getRepository(this.repoPath); lastFetched = (await repo?.getLastFetched()) ?? 0; } @@ -134,14 +165,14 @@ export class BranchTrackingStatusNode extends ViewNode implement remote?.provider?.name ? ` on ${remote?.provider.name}` : '' }`; description = Strings.pluralize('commit', this.status.state.ahead); - tooltip = `Branch ${this.branch.name} is ${Strings.pluralize( + tooltip = `Branch $(git-branch) ${this.branch.name} is ${Strings.pluralize( 'commit', this.status.state.ahead, - )} ahead of ${this.status.upstream}${remote?.provider?.name ? ` on ${remote.provider.name}` : ''}`; + { infix: '$(arrow-up) ' }, + )} ahead of $(git-branch) ${this.status.upstream}${ + remote?.provider?.name ? ` on ${remote.provider.name}` : '' + }`; - // collapsibleState = !this.isReposView - // ? TreeItemCollapsibleState.Expanded - // : TreeItemCollapsibleState.Collapsed; collapsibleState = TreeItemCollapsibleState.Collapsed; contextValue = this.root ? ContextValues.StatusAheadOfUpstream @@ -157,10 +188,13 @@ export class BranchTrackingStatusNode extends ViewNode implement remote?.provider?.name ? ` on ${remote.provider.name}` : '' }`; description = Strings.pluralize('commit', this.status.state.behind); - tooltip = `Branch ${this.branch.name} is ${Strings.pluralize( + tooltip = `Branch $(git-branch) ${this.branch.name} is ${Strings.pluralize( 'commit', this.status.state.behind, - )} behind ${this.status.upstream}${remote?.provider?.name ? ` on ${remote.provider.name}` : ''}`; + { infix: '$(arrow-down) ' }, + )} behind $(git-branch) ${this.status.upstream}${ + remote?.provider?.name ? ` on ${remote.provider.name}` : '' + }`; collapsibleState = TreeItemCollapsibleState.Collapsed; contextValue = this.root @@ -176,10 +210,10 @@ export class BranchTrackingStatusNode extends ViewNode implement label = `Up to date with ${remote?.name ?? GitBranch.getRemote(this.status.upstream!)}${ remote?.provider?.name ? ` on ${remote.provider.name}` : '' }`; - description = `Last fetched ${Dates.getFormatter(new Date(lastFetched)).fromNow()}`; - tooltip = `Branch ${this.branch.name} is up to date with ${this.status.upstream}${ - remote?.provider?.name ? ` on ${remote.provider.name}` : '' - }`; + description = lastFetched ? `Last fetched ${Dates.getFormatter(new Date(lastFetched)).fromNow()}` : ''; + tooltip = `Branch $(git-branch) ${this.branch.name} is up to date with $(git-branch) ${ + this.status.upstream + }${remote?.provider?.name ? ` on ${remote.provider.name}` : ''}`; collapsibleState = TreeItemCollapsibleState.None; contextValue = this.root ? ContextValues.StatusSameAsUpstream : undefined; @@ -194,7 +228,9 @@ export class BranchTrackingStatusNode extends ViewNode implement const providerName = providers?.length ? providers[0].name : undefined; label = `Publish ${this.branch.name} to ${providerName ?? 'a remote'}`; - tooltip = `Branch ${this.branch.name} hasn't been published to ${providerName ?? 'a remote'}`; + tooltip = `Branch $(git-branch) ${this.branch.name} hasn't been published to ${ + providerName ?? 'a remote' + }`; collapsibleState = TreeItemCollapsibleState.None; contextValue = this.root ? ContextValues.StatusNoUpstream : undefined; @@ -209,19 +245,14 @@ export class BranchTrackingStatusNode extends ViewNode implement item.contextValue = contextValue; item.description = description; if (lastFetched) { - tooltip += `\nLast fetched ${Dates.getFormatter(new Date(lastFetched)).fromNow()}`; + tooltip += `\n\nLast fetched ${Dates.getFormatter(new Date(lastFetched)).fromNow()}`; } item.iconPath = icon; - item.tooltip = tooltip; + item.tooltip = new MarkdownString(tooltip, true); return item; } - @memoize() - private get isReposView() { - return this.view instanceof RepositoriesView; - } - @gate() @debug() refresh(reset?: boolean) { diff --git a/src/views/nodes/branchesNode.ts b/src/views/nodes/branchesNode.ts index 62cbada..e38a0ca 100644 --- a/src/views/nodes/branchesNode.ts +++ b/src/views/nodes/branchesNode.ts @@ -42,14 +42,17 @@ export class BranchesNode extends ViewNode { const branches = await this.repo.getBranches({ // only show local branches filter: b => !b.remote, - sort: this.view instanceof RepositoriesView ? true : { current: false }, + sort: { current: false }, }); if (branches.length === 0) return [new MessageNode(this.view, this, 'No branches could be found.')]; const branchNodes = branches.map( b => new BranchNode(GitUri.fromRepoPath(this.uri.repoPath!, b.ref), this.view, this, b, false, { - showComparison: this.view.config.showBranchComparison, + showComparison: + this.view instanceof RepositoriesView + ? this.view.config.branches.showBranchComparison + : this.view.config.showBranchComparison, }), ); if (this.view.config.branches.layout === ViewBranchesLayout.List) return branchNodes; diff --git a/src/views/nodes/compareBranchNode.ts b/src/views/nodes/compareBranchNode.ts index ef1c318..c54f7c6 100644 --- a/src/views/nodes/compareBranchNode.ts +++ b/src/views/nodes/compareBranchNode.ts @@ -17,8 +17,8 @@ import { ContextValues, ViewNode } from './viewNode'; export class CompareBranchNode extends ViewNode { static key = ':compare-branch'; - static getId(repoPath: string, name: string): string { - return `${RepositoryNode.getId(repoPath)}${this.key}(${name})`; + static getId(repoPath: string, name: string, root: boolean): string { + return `${RepositoryNode.getId(repoPath)}${this.key}(${name})${root ? ':root' : ''}`; } private _children: ViewNode[] | undefined; @@ -29,6 +29,9 @@ export class CompareBranchNode extends ViewNode { const branchNodes = branches.map( b => new BranchNode(GitUri.fromRepoPath(this.uri.repoPath!, b.ref), this.view, this, b, false, { + showComparison: false, showTracking: false, }), ); diff --git a/src/views/nodes/repositoryNode.ts b/src/views/nodes/repositoryNode.ts index 4a799c8..fa29eb2 100644 --- a/src/views/nodes/repositoryNode.ts +++ b/src/views/nodes/repositoryNode.ts @@ -1,11 +1,10 @@ 'use strict'; -import { Disposable, TreeItem, TreeItemCollapsibleState } from 'vscode'; +import { Disposable, MarkdownString, TreeItem, TreeItemCollapsibleState } from 'vscode'; import { GlyphChars } from '../../constants'; import { Container } from '../../container'; import { GitBranch, GitRemote, - GitRevision, GitStatus, Repository, RepositoryChange, @@ -71,45 +70,87 @@ export class RepositoryNode extends SubscribeableViewNode { ); if (this.view.config.showBranchComparison !== false) { - children.push(new CompareBranchNode(this.uri, this.view, this, branch)); + children.push( + new CompareBranchNode( + this.uri, + this.view, + this, + branch, + this.view.config.showBranchComparison, + true, + ), + ); } - if (status.upstream) { - if (status.state.behind) { - children.push(new BranchTrackingStatusNode(this.view, this, branch, status, 'behind', true)); - } - - if (status.state.ahead) { - children.push(new BranchTrackingStatusNode(this.view, this, branch, status, 'ahead', true)); + if (this.view.config.showUpstreamStatus) { + if (status.upstream) { + if (!status.state.behind && !status.state.ahead) { + children.push(new BranchTrackingStatusNode(this.view, this, branch, status, 'same', true)); + } else { + if (status.state.behind) { + children.push( + new BranchTrackingStatusNode(this.view, this, branch, status, 'behind', true), + ); + } + + if (status.state.ahead) { + children.push( + new BranchTrackingStatusNode(this.view, this, branch, status, 'ahead', true, { + showAheadCommits: true, + }), + ); + } + } + } else { + children.push(new BranchTrackingStatusNode(this.view, this, branch, status, 'none', true)); } - } else { - children.push(new BranchTrackingStatusNode(this.view, this, branch, status, 'none', true)); } - if (status.state.ahead || (status.files.length !== 0 && this.includeWorkingTree)) { - const range = status.upstream ? GitRevision.createRange(status.upstream, branch.ref) : undefined; + if (this.view.config.includeWorkingTree && status.files.length !== 0) { + const range = undefined; //status.upstream ? GitRevision.createRange(status.upstream, branch.ref) : undefined; children.push(new StatusFilesNode(this.view, this, status, range)); } - children.push(new BranchNode(this.uri, this.view, this, branch, true)); - - if (!this.view.config.compact) { + if (children.length !== 0 && !this.view.config.compact) { children.push(new MessageNode(this.view, this, '', GlyphChars.Dash.repeat(2), '')); } + + if (this.view.config.showCommits) { + children.push( + new BranchNode(this.uri, this.view, this, branch, true, { + showAsCommits: true, + showComparison: false, + showCurrent: false, + showTracking: false, + }), + ); + } } - children.push( - new BranchesNode(this.uri, this.view, this, this.repo), - new ContributorsNode(this.uri, this.view, this, this.repo), - ); + if (this.view.config.showBranches) { + children.push(new BranchesNode(this.uri, this.view, this, this.repo)); + } + + if (this.view.config.showRemotes) { + children.push(new RemotesNode(this.uri, this.view, this, this.repo)); + } - children.push(new ReflogNode(this.uri, this.view, this, this.repo)); + if (this.view.config.showStashes) { + children.push(new StashesNode(this.uri, this.view, this, this.repo)); + } + + if (this.view.config.showTags) { + children.push(new TagsNode(this.uri, this.view, this, this.repo)); + } + + if (this.view.config.showContributors) { + children.push(new ContributorsNode(this.uri, this.view, this, this.repo)); + } + + if (this.view.config.showIncomingActivity) { + children.push(new ReflogNode(this.uri, this.view, this, this.repo)); + } - children.push( - new RemotesNode(this.uri, this.view, this, this.repo), - new StashesNode(this.uri, this.view, this, this.repo), - new TagsNode(this.uri, this.view, this, this.repo), - ); this._children = children; } return this._children; @@ -139,20 +180,20 @@ export class RepositoryNode extends SubscribeableViewNode { const status = await this._status; if (status != null) { - tooltip += `\n\nBranch ${status.branch}`; + tooltip += `\n\nCurrent branch $(git-branch) ${status.branch}`; - if (status.files.length !== 0 && this.includeWorkingTree) { + if (this.view.config.includeWorkingTree && status.files.length !== 0) { workingStatus = status.getFormattedDiffStatus({ compact: true, - prefix: Strings.pad(GlyphChars.Dot, 2, 2), + prefix: Strings.pad(GlyphChars.Dot, 1, 1), }); } const upstreamStatus = status.getUpstreamStatus({ - prefix: `${GlyphChars.Space} `, + suffix: Strings.pad(GlyphChars.Dot, 1, 1), }); - description = `${status.branch}${upstreamStatus}${workingStatus}`; + description = `${upstreamStatus}${status.branch}${workingStatus}`; let providerName; if (status.upstream != null) { @@ -166,10 +207,13 @@ export class RepositoryNode extends SubscribeableViewNode { iconSuffix = workingStatus ? '-blue' : ''; if (status.upstream != null) { tooltip += ` is ${status.getUpstreamStatus({ - empty: `up to date with ${status.upstream}${providerName ? ` on ${providerName}` : ''}`, + empty: `up to date with $(git-branch) ${status.upstream}${ + providerName ? ` on ${providerName}` : '' + }`, expand: true, - separator: ',', - suffix: ` ${status.upstream}${providerName ? ` on ${providerName}` : ''}`, + icons: true, + separator: ', ', + suffix: ` $(git-branch) ${status.upstream}${providerName ? ` on ${providerName}` : ''}`, })}`; if (status.state.behind) { @@ -200,7 +244,7 @@ export class RepositoryNode extends SubscribeableViewNode { item.contextValue = contextValue; item.description = `${description ?? ''}${ lastFetched - ? `${Strings.pad(GlyphChars.Dot, 2, 2)}Last fetched ${Repository.formatLastFetched(lastFetched)}` + ? `${Strings.pad(GlyphChars.Dot, 1, 1)}Last fetched ${Repository.formatLastFetched(lastFetched)}` : '' }`; item.iconPath = { @@ -208,7 +252,7 @@ export class RepositoryNode extends SubscribeableViewNode { light: Container.context.asAbsolutePath(`images/light/icon-repo${iconSuffix}.svg`), }; item.id = this.id; - item.tooltip = tooltip; + item.tooltip = new MarkdownString(tooltip, true); return item; } @@ -276,7 +320,7 @@ export class RepositoryNode extends SubscribeableViewNode { ); } - if (this.includeWorkingTree) { + if (this.view.config.includeWorkingTree) { disposables.push( this.repo.onDidChangeFileSystem(this.onFileSystemChanged, this), this.repo.startWatchingFileSystem(), @@ -286,10 +330,6 @@ export class RepositoryNode extends SubscribeableViewNode { return Disposable.from(...disposables); } - private get includeWorkingTree(): boolean { - return this.view.config.includeWorkingTree; - } - protected get requiresResetOnVisible(): boolean { return this._repoUpdatedAt !== this.repo.updatedAt; } @@ -325,7 +365,7 @@ export class RepositoryNode extends SubscribeableViewNode { index++; } - const range = status.upstream ? GitRevision.createRange(status.upstream, status.sha) : undefined; + const range = undefined; //status.upstream ? GitRevision.createRange(status.upstream, status.sha) : undefined; this._children.splice(index, deleteCount, new StatusFilesNode(this.view, this, status, range)); } else if (index !== -1) { this._children.splice(index, 1); diff --git a/src/views/nodes/statusFilesNode.ts b/src/views/nodes/statusFilesNode.ts index ed0dcc6..dd217ea 100644 --- a/src/views/nodes/statusFilesNode.ts +++ b/src/views/nodes/statusFilesNode.ts @@ -70,7 +70,7 @@ export class StatusFilesNode extends ViewNode { } } - if (this.status.files.length !== 0 && this.includeWorkingTree) { + if (this.view.config.includeWorkingTree && this.status.files.length !== 0) { files.splice( 0, 0, @@ -133,29 +133,31 @@ export class StatusFilesNode extends ViewNode { } async getTreeItem(): Promise { - let files = this.includeWorkingTree ? this.status.files.length : 0; + let files = this.view.config.includeWorkingTree ? this.status.files.length : 0; - if (this.status.upstream != null && this.status.state.ahead > 0) { - if (files > 0) { - const aheadFiles = await Container.git.getDiffStatus(this.repoPath, `${this.status.upstream}...`); - - if (aheadFiles != null) { - const uniques = new Set(); - for (const f of this.status.files) { - uniques.add(f.fileName); - } - for (const f of aheadFiles) { - uniques.add(f.fileName); + if (this.range != null) { + if (this.status.upstream != null && this.status.state.ahead > 0) { + if (files > 0) { + const aheadFiles = await Container.git.getDiffStatus(this.repoPath, `${this.status.upstream}...`); + + if (aheadFiles != null) { + const uniques = new Set(); + for (const f of this.status.files) { + uniques.add(f.fileName); + } + for (const f of aheadFiles) { + uniques.add(f.fileName); + } + + files = uniques.size; } - - files = uniques.size; - } - } else { - const stats = await Container.git.getChangedFilesCount(this.repoPath, `${this.status.upstream}...`); - if (stats != null) { - files += stats.files; } else { - files = -1; + const stats = await Container.git.getChangedFilesCount(this.repoPath, `${this.status.upstream}...`); + if (stats != null) { + files += stats.files; + } else { + files = -1; + } } } } @@ -172,10 +174,6 @@ export class StatusFilesNode extends ViewNode { return item; } - private get includeWorkingTree(): boolean { - return this.view.config.includeWorkingTree; - } - private toStatusFile(file: GitStatusFile, ref: string, previousRef: string, date?: Date): GitFileWithCommit { return { status: file.status, diff --git a/src/views/repositoriesView.ts b/src/views/repositoriesView.ts index 522d5eb..95cc4cb 100644 --- a/src/views/repositoriesView.ts +++ b/src/views/repositoriesView.ts @@ -30,6 +30,10 @@ import { BranchesNode, BranchNode, BranchOrTagFolderNode, + BranchTrackingStatusNode, + CompareBranchNode, + ContributorsNode, + ReflogNode, RemoteNode, RemotesNode, RepositoriesNode, @@ -113,6 +117,110 @@ export class RepositoriesView extends ViewBase this.setShowBranchComparison(false), this, ); + commands.registerCommand( + this.getQualifiedCommand('setBranchesShowBranchComparisonOn'), + () => this.setBranchShowBranchComparison(true), + this, + ); + commands.registerCommand( + this.getQualifiedCommand('setBranchesShowBranchComparisonOff'), + () => this.setBranchShowBranchComparison(false), + this, + ); + + commands.registerCommand( + this.getQualifiedCommand('setShowBranchesOn'), + () => this.toggleSection('showBranches', true), + this, + ); + commands.registerCommand( + this.getQualifiedCommand('setShowBranchesOff'), + () => this.toggleSection('showBranches', false), + this, + ); + + commands.registerCommand( + this.getQualifiedCommand('setShowCommitsOn'), + () => this.toggleSection('showCommits', true), + this, + ); + commands.registerCommand( + this.getQualifiedCommand('setShowCommitsOff'), + () => this.toggleSection('showCommits', false), + this, + ); + + commands.registerCommand( + this.getQualifiedCommand('setShowContributorsOn'), + () => this.toggleSection('showContributors', true), + this, + ); + commands.registerCommand( + this.getQualifiedCommand('setShowContributorsOff'), + () => this.toggleSection('showContributors', false), + this, + ); + + commands.registerCommand( + this.getQualifiedCommand('setShowRemotesOn'), + () => this.toggleSection('showRemotes', true), + this, + ); + commands.registerCommand( + this.getQualifiedCommand('setShowRemotesOff'), + () => this.toggleSection('showRemotes', false), + this, + ); + + commands.registerCommand( + this.getQualifiedCommand('setShowStashesOn'), + () => this.toggleSection('showStashes', true), + this, + ); + commands.registerCommand( + this.getQualifiedCommand('setShowStashesOff'), + () => this.toggleSection('showStashes', false), + this, + ); + + commands.registerCommand( + this.getQualifiedCommand('setShowTagsOn'), + () => this.toggleSection('showTags', true), + this, + ); + commands.registerCommand( + this.getQualifiedCommand('setShowTagsOff'), + () => this.toggleSection('showTags', false), + this, + ); + + commands.registerCommand( + this.getQualifiedCommand('setShowUpstreamStatusOn'), + () => this.toggleSection('showUpstreamStatus', true), + this, + ); + commands.registerCommand( + this.getQualifiedCommand('setShowUpstreamStatusOff'), + () => this.toggleSection('showUpstreamStatus', false), + this, + ); + + commands.registerCommand( + this.getQualifiedCommand('setShowSectionOff'), + ( + node: + | BranchesNode + | BranchNode + | BranchTrackingStatusNode + | CompareBranchNode + | ContributorsNode + | ReflogNode + | RemotesNode + | StashesNode + | TagsNode, + ) => this.toggleSectionByNode(node, false), + this, + ); } protected filterConfigurationChanged(e: ConfigurationChangeEvent) { @@ -573,4 +681,81 @@ export class RepositoriesView extends ViewBase Show associated pull requests

@@ -72,7 +72,7 @@ disabled /> Show the pull request associated with each branch @@ -87,7 +87,7 @@ disabled /> Show the pull request that introduced each commit diff --git a/src/webviews/apps/settings/partials/views.commits.html b/src/webviews/apps/settings/partials/views.commits.html index b92a98b..f122424 100644 --- a/src/webviews/apps/settings/partials/views.commits.html +++ b/src/webviews/apps/settings/partials/views.commits.html @@ -65,7 +65,7 @@ data-setting /> Show associated pull requests

@@ -84,7 +84,7 @@ disabled /> Show the pull request associated with the current branch @@ -99,7 +99,7 @@ disabled /> Show the pull request that introduced each commit diff --git a/src/webviews/apps/settings/partials/views.contributors.html b/src/webviews/apps/settings/partials/views.contributors.html index eb1b613..02da8e0 100644 --- a/src/webviews/apps/settings/partials/views.contributors.html +++ b/src/webviews/apps/settings/partials/views.contributors.html @@ -38,7 +38,7 @@ data-setting /> Show associated pull requests

@@ -57,7 +57,7 @@ disabled /> Show the pull request that introduced each commit diff --git a/src/webviews/apps/settings/partials/views.remotes.html b/src/webviews/apps/settings/partials/views.remotes.html index 72262dd..cd4af52 100644 --- a/src/webviews/apps/settings/partials/views.remotes.html +++ b/src/webviews/apps/settings/partials/views.remotes.html @@ -38,7 +38,7 @@ data-setting /> Show associated pull requests

@@ -57,7 +57,7 @@ disabled /> Show the pull request associated with each branch @@ -72,7 +72,7 @@ disabled /> Show the pull request that introduced each commit diff --git a/src/webviews/apps/settings/partials/views.repositories.html b/src/webviews/apps/settings/partials/views.repositories.html index 794f195..68bc873 100644 --- a/src/webviews/apps/settings/partials/views.repositories.html +++ b/src/webviews/apps/settings/partials/views.repositories.html @@ -29,6 +29,224 @@

+ +
+
+ +
+
+
+ + +
+ +
+ +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+
+
+
+ + +
+

+ Requires a connection to a supported remote service (e.g. GitHub) +

+
+ +
+
+
+ + +
+
+ +
+
+ + +
+
+
+
+
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+
+ +
+
- -
-
- -
-
- - -
- -
- -
-
- -
-
-
-
-
- - -
-

- Requires a connection to a supported remote service (e.g. GitHub) -

-
- -
-
-
- - -
-
- -
-
- - -
-
-
-
+
@@ -180,34 +307,6 @@
- -
- -
-
-
- -
-
- -
- -
-
-
- -
-
- + +
+ +
+
+
+ +
+
+ +
+ +
diff --git a/src/webviews/apps/settings/partials/views.searchAndCompare.html b/src/webviews/apps/settings/partials/views.searchAndCompare.html index 14d938a..7afa3c8 100644 --- a/src/webviews/apps/settings/partials/views.searchAndCompare.html +++ b/src/webviews/apps/settings/partials/views.searchAndCompare.html @@ -39,7 +39,7 @@ data-setting /> Show associated pull requests

@@ -58,7 +58,7 @@ disabled /> Show the pull request that introduced each commit