|
5 | 5 |
|
6 | 6 | import * as os from 'os';
|
7 | 7 | import * as path from 'path';
|
8 |
| -import { Command, commands, Disposable, LineChange, MessageOptions, Position, ProgressLocation, QuickPickItem, Range, SourceControlResourceState, TextDocumentShowOptions, TextEditor, Uri, ViewColumn, window, workspace, WorkspaceEdit, WorkspaceFolder, TimelineItem, env, Selection, TextDocumentContentProvider, InputBoxValidationSeverity, TabInputText, TabInputTextMerge, QuickPickItemKind, TextDocument, LogOutputChannel, l10n } from 'vscode'; |
| 8 | +import { Command, commands, Disposable, LineChange, MessageOptions, Position, ProgressLocation, QuickPickItem, Range, SourceControlResourceState, TextDocumentShowOptions, TextEditor, Uri, ViewColumn, window, workspace, WorkspaceEdit, WorkspaceFolder, TimelineItem, env, Selection, TextDocumentContentProvider, InputBoxValidationSeverity, TabInputText, TabInputTextMerge, QuickPickItemKind, TextDocument, LogOutputChannel, l10n, Memento } from 'vscode'; |
9 | 9 | import TelemetryReporter from '@vscode/extension-telemetry';
|
10 | 10 | import { uniqueNamesGenerator, adjectives, animals, colors, NumberDictionary } from '@joaomoreno/unique-names-generator';
|
11 | 11 | import { Branch, ForcePushMode, GitErrorCodes, Ref, RefType, Status, CommitOptions, RemoteSourcePublisher, Remote } from './api/git';
|
@@ -351,6 +351,7 @@ export class CommandCenter {
|
351 | 351 | constructor(
|
352 | 352 | private git: Git,
|
353 | 353 | private model: Model,
|
| 354 | + private globalState: Memento, |
354 | 355 | private logger: LogOutputChannel,
|
355 | 356 | private telemetryReporter: TelemetryReporter
|
356 | 357 | ) {
|
@@ -2544,12 +2545,20 @@ export class CommandCenter {
|
2544 | 2545 | return;
|
2545 | 2546 | }
|
2546 | 2547 |
|
2547 |
| - const branchName = repository.HEAD.name; |
2548 |
| - const message = l10n.t('The branch "{0}" has no remote branch. Would you like to publish this branch?', branchName); |
2549 |
| - const yes = l10n.t('OK'); |
2550 |
| - const pick = await window.showWarningMessage(message, { modal: true }, yes); |
| 2548 | + if (this.globalState.get<boolean>('confirmBranchPublish', true)) { |
| 2549 | + const branchName = repository.HEAD.name; |
| 2550 | + const message = l10n.t('The branch "{0}" has no remote branch. Would you like to publish this branch?', branchName); |
| 2551 | + const yes = l10n.t('OK'); |
| 2552 | + const neverAgain = l10n.t('OK, Don\'t Ask Again'); |
| 2553 | + const pick = await window.showWarningMessage(message, { modal: true }, yes, neverAgain); |
2551 | 2554 |
|
2552 |
| - if (pick === yes) { |
| 2555 | + if (pick === yes || pick === neverAgain) { |
| 2556 | + if (pick === neverAgain) { |
| 2557 | + this.globalState.update('confirmBranchPublish', false); |
| 2558 | + } |
| 2559 | + await this.publish(repository); |
| 2560 | + } |
| 2561 | + } else { |
2553 | 2562 | await this.publish(repository);
|
2554 | 2563 | }
|
2555 | 2564 | }
|
|
0 commit comments