Skip to content

Commit

Permalink
Adds stashes into Commit view
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed Dec 2, 2024
1 parent ba5dfbb commit 34cd987
Show file tree
Hide file tree
Showing 13 changed files with 275 additions and 66 deletions.
155 changes: 149 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1743,6 +1743,13 @@
"title": "Commits View",
"order": 110,
"properties": {
"gitlens.views.commits.showStashes": {
"type": "boolean",
"default": true,
"markdownDescription": "Specifies whether to show stashes in the _Commits_ view",
"scope": "window",
"order": 9
},
"gitlens.views.commits.showBranchComparison": {
"type": [
"boolean",
Expand Down Expand Up @@ -2192,6 +2199,13 @@
"scope": "window",
"order": 90
},
"gitlens.views.repositories.branches.showStashes": {
"type": "boolean",
"default": true,
"markdownDescription": "Specifies whether to show stashes in the _Commits_ and _Branches_ sections of the _Repositories_ view",
"scope": "window",
"order": 95
},
"gitlens.views.repositories.branches.showBranchComparison": {
"type": [
"boolean",
Expand Down Expand Up @@ -2355,6 +2369,13 @@
"title": "Branches View",
"order": 170,
"properties": {
"gitlens.views.branches.showStashes": {
"type": "boolean",
"default": true,
"markdownDescription": "Specifies whether to show stashes in the _Branches_ view",
"scope": "window",
"order": 9
},
"gitlens.views.branches.showBranchComparison": {
"type": [
"boolean",
Expand Down Expand Up @@ -2756,6 +2777,13 @@
"scope": "resource",
"order": 12
},
"gitlens.views.worktrees.showStashes": {
"type": "boolean",
"default": true,
"markdownDescription": "Specifies whether to show stashes in the _Worktrees_ view",
"scope": "window",
"order": 19
},
"gitlens.views.worktrees.showBranchComparison": {
"type": [
"boolean",
Expand Down Expand Up @@ -3337,6 +3365,13 @@
"scope": "window",
"order": 90
},
"gitlens.views.workspaces.branches.showStashes": {
"type": "boolean",
"default": true,
"markdownDescription": "Specifies whether to show stashes in the _Cloud Workspaces_ view",
"scope": "window",
"order": 9
},
"gitlens.views.workspaces.branches.showBranchComparison": {
"type": [
"boolean",
Expand Down Expand Up @@ -7673,6 +7708,14 @@
"command": "gitlens.views.branches.setShowBranchPullRequestOff",
"title": "Hide Branch Pull Requests"
},
{
"command": "gitlens.views.branches.setShowStashesOn",
"title": "Show Stashes"
},
{
"command": "gitlens.views.branches.setShowStashesOff",
"title": "Hide Stashes"
},
{
"command": "gitlens.views.commitDetails.refresh",
"title": "Refresh",
Expand Down Expand Up @@ -7759,6 +7802,14 @@
"command": "gitlens.views.commits.setShowBranchPullRequestOff",
"title": "Hide Current Branch Pull Request"
},
{
"command": "gitlens.views.commits.setShowStashesOn",
"title": "Show Stashes"
},
{
"command": "gitlens.views.commits.setShowStashesOff",
"title": "Hide Stashes"
},
{
"command": "gitlens.views.contributors.copy",
"title": "Copy"
Expand Down Expand Up @@ -8804,6 +8855,14 @@
"command": "gitlens.views.worktrees.setShowBranchPullRequestOff",
"title": "Hide Branch Pull Requests"
},
{
"command": "gitlens.views.worktrees.setShowStashesOn",
"title": "Show Stashes"
},
{
"command": "gitlens.views.worktrees.setShowStashesOff",
"title": "Hide Stashes"
},
{
"command": "gitlens.enableDebugLogging",
"title": "Enable Debug Logging",
Expand Down Expand Up @@ -11266,6 +11325,14 @@
"command": "gitlens.views.branches.setShowBranchPullRequestOff",
"when": "false"
},
{
"command": "gitlens.views.branches.setShowStashesOn",
"when": "false"
},
{
"command": "gitlens.views.branches.setShowStashesOff",
"when": "false"
},
{
"command": "gitlens.views.commitDetails.refresh",
"when": "false"
Expand Down Expand Up @@ -11342,6 +11409,14 @@
"command": "gitlens.views.commits.setShowBranchPullRequestOff",
"when": "false"
},
{
"command": "gitlens.views.commits.setShowStashesOn",
"when": "false"
},
{
"command": "gitlens.views.commits.setShowStashesOff",
"when": "false"
},
{
"command": "gitlens.views.contributors.copy",
"when": "false"
Expand Down Expand Up @@ -12238,6 +12313,14 @@
"command": "gitlens.views.worktrees.setShowBranchPullRequestOff",
"when": "false"
},
{
"command": "gitlens.views.worktrees.setShowStashesOn",
"when": "false"
},
{
"command": "gitlens.views.worktrees.setShowStashesOff",
"when": "false"
},
{
"command": "gitlens.graph.switchToEditorLayout",
"when": "gitlens:enabled && config.gitlens.graph.layout != editor"
Expand Down Expand Up @@ -13271,6 +13354,16 @@
"when": "view == gitlens.views.branches && config.gitlens.views.branches.pullRequests.enabled && config.gitlens.views.branches.pullRequests.showForBranches",
"group": "5_gitlens@2"
},
{
"command": "gitlens.views.branches.setShowStashesOn",
"when": "view == gitlens.views.branches && !config.gitlens.views.branches.showStashes",
"group": "5_gitlens@11"
},
{
"command": "gitlens.views.branches.setShowStashesOff",
"when": "view == gitlens.views.branches && config.gitlens.views.branches.showStashes",
"group": "5_gitlens@11"
},
{
"command": "gitlens.pushRepositories",
"when": "gitlens:repos:withRemotes && !gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders && view == gitlens.views.commits",
Expand Down Expand Up @@ -13379,7 +13472,17 @@
{
"command": "gitlens.views.commits.setShowBranchPullRequestOff",
"when": "view == gitlens.views.commits && config.gitlens.views.commits.pullRequests.enabled && config.gitlens.views.commits.pullRequests.showForBranches",
"group": "5_gitlens@4"
"group": "5_gitlens@3"
},
{
"command": "gitlens.views.commits.setShowStashesOn",
"when": "view == gitlens.views.commits && !config.gitlens.views.commits.showStashes",
"group": "5_gitlens@11"
},
{
"command": "gitlens.views.commits.setShowStashesOff",
"when": "view == gitlens.views.commits && config.gitlens.views.commits.showStashes",
"group": "5_gitlens@11"
},
{
"command": "gitlens.showGraph",
Expand Down Expand Up @@ -14331,15 +14434,25 @@
"when": "view == gitlens.views.worktrees && config.gitlens.views.worktrees.pullRequests.enabled && config.gitlens.views.worktrees.pullRequests.showForBranches",
"group": "5_gitlens@2"
},
{
"command": "gitlens.views.worktrees.setShowStashesOn",
"when": "view == gitlens.views.worktrees && !config.gitlens.views.worktrees.showStashes",
"group": "5_gitlens@11"
},
{
"command": "gitlens.views.worktrees.setShowStashesOff",
"when": "view == gitlens.views.worktrees && config.gitlens.views.worktrees.showStashes",
"group": "5_gitlens@11"
},
{
"command": "gitlens.views.setShowRelativeDateMarkersOn",
"when": "view =~ /^gitlens\\.views\\.(branches|commits|contributors|fileHistory|lineHistory|remotes|repositories|tags|worktrees)/ && !config.gitlens.views.showRelativeDateMarkers",
"group": "5_gitlens@3"
"group": "5_gitlens@10"
},
{
"command": "gitlens.views.setShowRelativeDateMarkersOff",
"when": "view =~ /^gitlens\\.views\\.(branches|commits|contributors|fileHistory|lineHistory|remotes|repositories|tags|worktrees)/ && config.gitlens.views.showRelativeDateMarkers",
"group": "5_gitlens@3"
"group": "5_gitlens@10"
},
{
"submenu": "gitlens/graph/configuration",
Expand Down Expand Up @@ -17798,12 +17911,12 @@
{
"command": "gitlens.views.setShowRelativeDateMarkersOn",
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view =~ /(branches|commits|contributors|remotes|repositories|tags|worktrees)/ && !config.gitlens.views.showRelativeDateMarkers",
"group": "5_gitlens@3"
"group": "5_gitlens@10"
},
{
"command": "gitlens.views.setShowRelativeDateMarkersOff",
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view =~ /(branches|commits|contributors|remotes|repositories|tags|worktrees)/ && config.gitlens.views.showRelativeDateMarkers",
"group": "5_gitlens@3"
"group": "5_gitlens@10"
},
{
"command": "gitlens.views.branches.setLayoutToList",
Expand Down Expand Up @@ -17860,6 +17973,16 @@
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == branches && config.gitlens.views.branches.pullRequests.enabled && config.gitlens.views.branches.pullRequests.showForBranches",
"group": "5_gitlens@2"
},
{
"command": "gitlens.views.branches.setShowStashesOn",
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == branches && !config.gitlens.views.branches.showStashes",
"group": "5_gitlens@11"
},
{
"command": "gitlens.views.branches.setShowStashesOff",
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == branches && config.gitlens.views.branches.showStashes",
"group": "5_gitlens@11"
},
{
"command": "gitlens.showSettingsPage!branches-view",
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == branches",
Expand Down Expand Up @@ -17918,7 +18041,17 @@
{
"command": "gitlens.views.commits.setShowBranchPullRequestOff",
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == commits && config.gitlens.views.commits.pullRequests.enabled && config.gitlens.views.commits.pullRequests.showForBranches",
"group": "5_gitlens@4"
"group": "5_gitlens@3"
},
{
"command": "gitlens.views.commits.setShowStashesOn",
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == commits && !config.gitlens.views.commits.showStashes",
"group": "5_gitlens@11"
},
{
"command": "gitlens.views.commits.setShowStashesOff",
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == commits && config.gitlens.views.commits.showStashes",
"group": "5_gitlens@11"
},
{
"command": "gitlens.showSettingsPage!commits-view",
Expand Down Expand Up @@ -18240,6 +18373,16 @@
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == worktrees && config.gitlens.views.worktrees.pullRequests.enabled && config.gitlens.views.worktrees.pullRequests.showForBranches",
"group": "5_gitlens@2"
},
{
"command": "gitlens.views.worktrees.setShowStashesOn",
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == worktrees && !config.gitlens.views.worktrees.showStashes",
"group": "5_gitlens@11"
},
{
"command": "gitlens.views.worktrees.setShowStashesOff",
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == worktrees && config.gitlens.views.worktrees.showStashes",
"group": "5_gitlens@11"
},
{
"command": "gitlens.showSettingsPage!worktrees-view",
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == worktrees",
Expand Down
5 changes: 5 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,7 @@ export interface BranchesViewConfig {
};
readonly reveal: boolean;
readonly showBranchComparison: false | Extract<ViewShowBranchComparison, 'branch'>;
readonly showStashes: boolean;
}

export interface CommitsViewConfig {
Expand All @@ -713,6 +714,7 @@ export interface CommitsViewConfig {
};
readonly reveal: boolean;
readonly showBranchComparison: false | ViewShowBranchComparison;
readonly showStashes: boolean;
}

export interface CommitDetailsViewConfig {
Expand Down Expand Up @@ -806,6 +808,7 @@ export interface RepositoriesViewConfig {
readonly branches: {
readonly layout: ViewBranchesLayout;
readonly showBranchComparison: false | Extract<ViewShowBranchComparison, 'branch'>;
readonly showStashes: boolean;
};
readonly compact: boolean;
readonly files: ViewsFilesConfig;
Expand Down Expand Up @@ -860,13 +863,15 @@ export interface WorktreesViewConfig {
};
readonly reveal: boolean;
readonly showBranchComparison: false | Extract<ViewShowBranchComparison, 'branch'>;
readonly showStashes: boolean;
}

export interface WorkspacesViewConfig {
readonly avatars: boolean;
readonly branches: {
readonly layout: ViewBranchesLayout;
readonly showBranchComparison: false | Extract<ViewShowBranchComparison, 'branch'>;
readonly showStashes: boolean;
};
readonly compact: boolean;
readonly files: ViewsFilesConfig;
Expand Down
9 changes: 6 additions & 3 deletions src/constants.commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ export type TreeViewCommands = `gitlens.views.${
| `setFilesLayoutTo${'Auto' | 'List' | 'Tree'}`
| `setShowAvatars${'On' | 'Off'}`
| `setShowBranchComparison${'On' | 'Off'}`
| `setShowBranchPullRequest${'On' | 'Off'}`}`
| `setShowBranchPullRequest${'On' | 'Off'}`
| `setShowStashes${'On' | 'Off'}`}`
| `commits.${
| 'copy'
| 'refresh'
Expand All @@ -346,7 +347,8 @@ export type TreeViewCommands = `gitlens.views.${
| `setShowAvatars${'On' | 'Off'}`
| `setShowBranchComparison${'On' | 'Off'}`
| `setShowBranchPullRequest${'On' | 'Off'}`
| `setShowMergeCommits${'On' | 'Off'}`}`
| `setShowMergeCommits${'On' | 'Off'}`
| `setShowStashes${'On' | 'Off'}`}`
| `contributors.${
| 'copy'
| 'refresh'
Expand Down Expand Up @@ -451,7 +453,8 @@ export type TreeViewCommands = `gitlens.views.${
| `setFilesLayoutTo${'Auto' | 'List' | 'Tree'}`
| `setShowAvatars${'On' | 'Off'}`
| `setShowBranchComparison${'On' | 'Off'}`
| `setShowBranchPullRequest${'On' | 'Off'}`}`}`;
| `setShowBranchPullRequest${'On' | 'Off'}`
| `setShowStashes${'On' | 'Off'}`}`}`;

type ExtractSuffix<Prefix extends string, U> = U extends `${Prefix}${infer V}` ? V : never;
type FilterCommands<Prefix extends string, U> = U extends `${Prefix}${infer V}` ? `${Prefix}${V}` : never;
Expand Down
6 changes: 5 additions & 1 deletion src/env/node/git/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1591,7 +1591,7 @@ export class Git {
async rev_list(
repoPath: string,
ref: string,
options?: { all?: boolean; maxParents?: number },
options?: { all?: boolean; maxParents?: number; since?: string },
): Promise<string[] | undefined> {
const params = ['rev-list'];
if (options?.all) {
Expand All @@ -1602,6 +1602,10 @@ export class Git {
params.push(`--max-parents=${options.maxParents}`);
}

if (options?.since) {
params.push(`--since="${options.since}"`, '--date-order');
}

const rawData = await this.git<string>(
{ cwd: repoPath, errors: GitErrorHandling.Ignore },
...params,
Expand Down
Loading

0 comments on commit 34cd987

Please sign in to comment.