Added quickpick option and display of tag annotation on menu

This commit is contained in:
Xhulio Hasani
2019-08-20 16:05:46 -04:00
parent 98ed0fc2e8
commit 32d59ba806
6 changed files with 70 additions and 13 deletions

View File

@@ -15,7 +15,7 @@ import { assign, groupBy, denodeify, IDisposable, toDisposable, dispose, mkdirp,
import { CancellationToken } from 'vscode';
import { URI } from 'vscode-uri';
import { detectEncoding } from './encoding';
import { Ref, RefType, Branch, Remote, GitErrorCodes, LogOptions, Change, Status } from './api/git';
import { Ref, RefType, Branch, Remote, GitErrorCodes, LogOptions, Change, Status, Tag } from './api/git';
// https://github.com/microsoft/vscode/issues/65693
const MAX_CLI_LENGTH = 30000;
@@ -1290,6 +1290,21 @@ export class Repository {
await this.run(args);
}
async getTags(): Promise<Tag[]> {
let args = ['tag', '-n1'];
const result = await this.run(args);
return result.stdout.trim().split('\n')
.map(line => line.trim().split('\0'))
.map(([line]) => {
const name = line.split(' ')[0];
return {
name: name,
message: line.replace(name, '').trim() || '',
type: RefType.Tag
} as Tag;
});
}
async clean(paths: string[]): Promise<void> {
const pathsByGroup = groupBy(paths, p => path.dirname(p));
const groups = Object.keys(pathsByGroup).map(k => pathsByGroup[k]);