mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 11:08:51 +01:00
SCM Graph - Add "Create Tag" action to history item context menu (#228428)
This commit is contained in:
@@ -201,8 +201,8 @@ export class ApiRepository implements Repository {
|
||||
return this.repository.getMergeBase(ref1, ref2);
|
||||
}
|
||||
|
||||
tag(name: string, upstream: string): Promise<void> {
|
||||
return this.repository.tag(name, upstream);
|
||||
tag(name: string, message: string, ref?: string | undefined): Promise<void> {
|
||||
return this.repository.tag({ name, message, ref });
|
||||
}
|
||||
|
||||
deleteTag(name: string): Promise<void> {
|
||||
|
||||
@@ -2907,7 +2907,7 @@ export class CommandCenter {
|
||||
}
|
||||
|
||||
@command('git.createTag', { repository: true })
|
||||
async createTag(repository: Repository): Promise<void> {
|
||||
async createTag(repository: Repository, historyItem?: SourceControlHistoryItem): Promise<void> {
|
||||
const inputTagName = await window.showInputBox({
|
||||
placeHolder: l10n.t('Tag name'),
|
||||
prompt: l10n.t('Please provide a tag name'),
|
||||
@@ -2925,7 +2925,7 @@ export class CommandCenter {
|
||||
});
|
||||
|
||||
const name = inputTagName.replace(/^\.|\/\.|\.\.|~|\^|:|\/$|\.lock$|\.lock\/|\\|\*|\s|^\s*$|\.$/g, '-');
|
||||
await repository.tag(name, inputMessage);
|
||||
await repository.tag({ name, message: inputMessage, ref: historyItem?.id });
|
||||
}
|
||||
|
||||
@command('git.deleteTag', { repository: true })
|
||||
|
||||
@@ -1807,13 +1807,17 @@ export class Repository {
|
||||
await this.exec(['merge', '--abort']);
|
||||
}
|
||||
|
||||
async tag(name: string, message?: string): Promise<void> {
|
||||
async tag(options: { name: string; message?: string; ref?: string }): Promise<void> {
|
||||
let args = ['tag'];
|
||||
|
||||
if (message) {
|
||||
args = [...args, '-a', name, '-m', message];
|
||||
if (options.message) {
|
||||
args = [...args, '-a', options.name, '-m', options.message];
|
||||
} else {
|
||||
args = [...args, name];
|
||||
args = [...args, options.name];
|
||||
}
|
||||
|
||||
if (options.ref) {
|
||||
args.push(options.ref);
|
||||
}
|
||||
|
||||
await this.exec(args);
|
||||
|
||||
@@ -1563,8 +1563,8 @@ export class Repository implements Disposable {
|
||||
await this.run(Operation.Rebase, () => this.repository.rebase(branch));
|
||||
}
|
||||
|
||||
async tag(name: string, message?: string): Promise<void> {
|
||||
await this.run(Operation.Tag, () => this.repository.tag(name, message));
|
||||
async tag(options: { name: string; message?: string; ref?: string }): Promise<void> {
|
||||
await this.run(Operation.Tag, () => this.repository.tag(options));
|
||||
}
|
||||
|
||||
async deleteTag(name: string): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user