Przeglądaj źródła

adds feature to prune remote

main
Zach Boyle 5 lat temu
committed by Eric Amodio
rodzic
commit
f274bc1a5e
4 zmienionych plików z 31 dodań i 0 usunięć
  1. +14
    -0
      package.json
  2. +4
    -0
      src/git/git.ts
  3. +5
    -0
      src/git/gitService.ts
  4. +8
    -0
      src/views/viewCommands.ts

+ 14
- 0
package.json Wyświetl plik

@ -2416,6 +2416,11 @@
}
},
{
"command": "gitlens.views.pruneRemote",
"title": "Prune",
"category": "GitLens"
},
{
"command": "gitlens.views.fetch",
"title": "Fetch",
"category": "GitLens",
@ -3393,6 +3398,10 @@
"when": "false"
},
{
"command": "gitlens.views.pruneRemote",
"when": "false"
},
{
"command": "gitlens.views.fetch",
"when": "false"
},
@ -4699,6 +4708,11 @@
"group": "1_gitlens@1"
},
{
"command": "gitlens.views.pruneRemote",
"when": "!gitlens:readonly && viewItem =~ /gitlens:remote\\b/",
"group": "1_gitlens@2"
},
{
"command": "gitlens.openRepoInRemote",
"when": "viewItem =~ /gitlens:remote\\b/",
"group": "2_gitlens@1"

+ 4
- 0
src/git/git.ts Wyświetl plik

@ -891,6 +891,10 @@ export class Git {
return git<string>({ cwd: repoPath }, 'remote', 'add', name, url);
}
static remote__prune(repoPath: string, remoteName: string) {
return git<string>({ cwd: repoPath }, 'remote', 'prune', remoteName);
}
static remote__get_url(repoPath: string, remote: string): Promise<string> {
return git<string>({ cwd: repoPath }, 'remote', 'get-url', remote);
}

+ 5
- 0
src/git/gitService.ts Wyświetl plik

@ -463,6 +463,11 @@ export class GitService implements Disposable {
}
@log()
pruneRemote(repoPath: string, remoteName: string) {
return Git.remote__prune(repoPath, remoteName);
}
@log()
async applyChangesToWorkingFile(uri: GitUri, ref1?: string, ref2?: string) {
const cc = Logger.getCorrelationContext();

+ 8
- 0
src/views/viewCommands.ts Wyświetl plik

@ -115,6 +115,7 @@ export class ViewCommands {
commands.registerCommand('gitlens.views.applyChanges', this.applyChanges, this);
commands.registerCommand('gitlens.views.checkout', this.checkout, this);
commands.registerCommand('gitlens.views.addRemote', this.addRemote, this);
commands.registerCommand('gitlens.views.pruneRemote', this.pruneRemote, this);
commands.registerCommand('gitlens.views.stageDirectory', this.stageDirectory, this);
commands.registerCommand('gitlens.views.stageFile', this.stageFile, this);
@ -292,6 +293,13 @@ export class ViewCommands {
return name;
}
private async pruneRemote(node: RemoteNode) {
const remoteName = node.remote.name;
void (await Container.git.pruneRemote(node.repo.path, remoteName));
return remoteName;
}
private closeRepository(node: RepositoryNode) {
if (!(node instanceof RepositoryNode)) return;

Ładowanie…
Anuluj
Zapisz