Browse Source

Fixes branch & tag sort honoring setting

main
Eric Amodio 3 years ago
parent
commit
5dc2d0a490
7 changed files with 12 additions and 41 deletions
  1. +1
    -4
      src/commands/openBranchOnRemote.ts
  2. +3
    -3
      src/commands/quickCommand.steps.ts
  3. +1
    -4
      src/quickpicks/referencePicker.ts
  4. +2
    -5
      src/views/nodes/compareBranchNode.ts
  5. +1
    -5
      src/views/nodes/fileHistoryTrackerNode.ts
  6. +1
    -5
      src/views/nodes/lineHistoryTrackerNode.ts
  7. +3
    -15
      src/views/searchAndCompareView.ts

+ 1
- 4
src/commands/openBranchOnRemote.ts View File

@ -10,7 +10,6 @@ import {
getRepoPathOrActiveOrPrompt,
isCommandContextViewNodeHasBranch,
} from './common';
import { BranchSorting } from '../configuration';
import { RemoteResourceType } from '../git/git';
import { GitUri } from '../git/gitUri';
import { Logger } from '../logger';
@ -70,9 +69,7 @@ export class OpenBranchOnRemoteCommand extends ActiveEditorCommand {
// checkmarks: false,
filter: { branches: b => b.tracking != null },
include: ReferencesQuickPickIncludes.Branches,
sort: {
branches: { current: true, orderBy: BranchSorting.DateDesc },
},
sort: { branches: { current: true }, tags: {} },
},
);
if (pick == null || pick instanceof CommandQuickPickItem) return;

+ 3
- 3
src/commands/quickCommand.steps.ts View File

@ -108,14 +108,14 @@ export async function getBranches(
repos: Repository | Repository[],
options: { filterBranches?: (b: GitBranch) => boolean; picked?: string | string[] } = {},
): Promise<BranchQuickPickItem[]> {
return getBranchesAndOrTags(repos, ['branches'], options) as Promise<BranchQuickPickItem[]>;
return getBranchesAndOrTags(repos, ['branches'], { sort: true, ...options }) as Promise<BranchQuickPickItem[]>;
}
export async function getTags(
repos: Repository | Repository[],
options: { filterTags?: (t: GitTag) => boolean; picked?: string | string[] } = {},
): Promise<TagQuickPickItem[]> {
return getBranchesAndOrTags(repos, ['tags'], options) as Promise<TagQuickPickItem[]>;
return getBranchesAndOrTags(repos, ['tags'], { sort: true, ...options }) as Promise<TagQuickPickItem[]>;
}
export async function getBranchesAndOrTags(
@ -537,7 +537,7 @@ export async function* pickBranchOrTagStep<
return getBranchesAndOrTags(state.repo, context.showTags ? ['branches', 'tags'] : ['branches'], {
filter: filter,
picked: picked,
sort: { branches: { orderBy: BranchSorting.DateDesc }, tags: { orderBy: TagSorting.DateDesc } },
sort: true,
});
};
const branchesAndOrTags = await getBranchesAndOrTagsFn();

+ 1
- 4
src/quickpicks/referencePicker.ts View File

@ -160,10 +160,7 @@ export namespace ReferencePicker {
{
filter: filter,
picked: picked,
sort: sort ?? {
branches: { current: false, orderBy: BranchSorting.DateDesc },
tags: { orderBy: TagSorting.DateDesc },
},
sort: sort ?? { branches: { current: false }, tags: {} },
},
);

+ 2
- 5
src/views/nodes/compareBranchNode.ts View File

@ -3,7 +3,7 @@ import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { BranchesView } from '../branchesView';
import { CommitsView } from '../commitsView';
import { BranchComparison, BranchComparisons, GlyphChars, WorkspaceState } from '../../constants';
import { BranchSorting, TagSorting, ViewShowBranchComparison } from '../../configuration';
import { ViewShowBranchComparison } from '../../configuration';
import { Container } from '../../container';
import { GitBranch, GitRevision } from '../../git/git';
import { GitUri } from '../../git/gitUri';
@ -221,10 +221,7 @@ export class CompareBranchNode extends ViewNode
allowEnteringRefs: true,
picked: this.branch.ref,
// checkmarks: true,
sort: {
branches: { current: true, orderBy: BranchSorting.DateDesc },
tags: { orderBy: TagSorting.DateDesc },
},
sort: { branches: { current: true }, tags: {} },
},
);
if (pick == null || pick instanceof CommandQuickPickItem) return;

+ 1
- 5
src/views/nodes/fileHistoryTrackerNode.ts View File

@ -1,7 +1,6 @@
'use strict';
import { Disposable, TextEditor, TreeItem, TreeItemCollapsibleState, window } from 'vscode';
import { UriComparer } from '../../comparers';
import { BranchSorting, TagSorting } from '../../configuration';
import { Container } from '../../container';
import { FileHistoryView } from '../fileHistoryView';
import { FileHistoryNode } from './fileHistoryNode';
@ -96,10 +95,7 @@ export class FileHistoryTrackerNode extends SubscribeableViewNode
allowEnteringRefs: true,
picked: this._base,
// checkmarks: true,
sort: {
branches: { current: true, orderBy: BranchSorting.DateDesc },
tags: { orderBy: TagSorting.DateDesc },
},
sort: { branches: { current: true }, tags: {} },
},
);
if (pick == null) return;

+ 1
- 5
src/views/nodes/lineHistoryTrackerNode.ts View File

@ -1,7 +1,6 @@
'use strict';
import { Selection, TreeItem, TreeItemCollapsibleState, window } from 'vscode';
import { UriComparer } from '../../comparers';
import { BranchSorting, TagSorting } from '../../configuration';
import { Container } from '../../container';
import { FileHistoryView } from '../fileHistoryView';
import { GitReference, GitRevision } from '../../git/git';
@ -102,10 +101,7 @@ export class LineHistoryTrackerNode extends SubscribeableViewNode
allowEnteringRefs: true,
picked: this._base,
// checkmarks: true,
sort: {
branches: { current: true, orderBy: BranchSorting.DateDesc },
tags: { orderBy: TagSorting.DateDesc },
},
sort: { branches: { current: true }, tags: {} },
},
);
if (pick == null) return;

+ 3
- 15
src/views/searchAndCompareView.ts View File

@ -1,12 +1,6 @@
'use strict';
import { commands, ConfigurationChangeEvent, TreeItem, TreeItemCollapsibleState } from 'vscode';
import {
BranchSorting,
configuration,
SearchAndCompareViewConfig,
TagSorting,
ViewFilesLayout,
} from '../configuration';
import { configuration, SearchAndCompareViewConfig, ViewFilesLayout } from '../configuration';
import { ContextKeys, NamedRef, PinnedItem, PinnedItems, setContext, WorkspaceState } from '../constants';
import { Container } from '../container';
import { GitLog, GitRevision, SearchPattern } from '../git/git';
@ -154,10 +148,7 @@ export class SearchAndCompareViewNode extends ViewNode {
ReferencesQuickPickIncludes.BranchesAndTags |
ReferencesQuickPickIncludes.HEAD |
ReferencesQuickPickIncludes.WorkingTree,
sort: {
branches: { current: true, orderBy: BranchSorting.DateDesc },
tags: { orderBy: TagSorting.DateDesc },
},
sort: { branches: { current: true } },
},
);
if (pick == null) {
@ -194,10 +185,7 @@ export class SearchAndCompareViewNode extends ViewNode {
ReferencesQuickPickIncludes.BranchesAndTags |
ReferencesQuickPickIncludes.HEAD |
ReferencesQuickPickIncludes.WorkingTree,
sort: {
branches: { current: true, orderBy: BranchSorting.DateDesc },
tags: { orderBy: TagSorting.DateDesc },
},
sort: { branches: { current: true }, tags: {} },
});
if (pick == null) {
await this.triggerChange();

Loading…
Cancel
Save