Procházet zdrojové kódy

Adds pull all command to repos explorer

main
Eric Amodio před 6 roky
rodič
revize
f27e080f8d
3 změnil soubory, kde provedl 58 přidání a 2 odebrání
  1. +19
    -1
      package.json
  2. +28
    -0
      src/views/nodes/repositoriesNode.ts
  3. +11
    -1
      src/views/repositoriesExplorer.ts

+ 19
- 1
package.json Zobrazit soubor

@ -1838,6 +1838,15 @@
}
},
{
"command": "gitlens.repositoriesExplorer.pullAll",
"title": "Pull Repositories",
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-pull.svg",
"light": "images/light/icon-pull.svg"
}
},
{
"command": "gitlens.explorers.fetch",
"title": "Fetch Repository",
"category": "GitLens",
@ -2425,6 +2434,10 @@
"when": "false"
},
{
"command": "gitlens.repositoriesExplorer.pullAll",
"when": "false"
},
{
"command": "gitlens.explorers.fetch",
"when": "false"
},
@ -2919,11 +2932,16 @@
"group": "navigation@7"
},
{
"command": "gitlens.repositoriesExplorer.refresh",
"command": "gitlens.repositoriesExplorer.pullAll",
"when": "view =~ /^gitlens.repositoriesExplorer:/",
"group": "navigation@8"
},
{
"command": "gitlens.repositoriesExplorer.refresh",
"when": "view =~ /^gitlens.repositoriesExplorer:/",
"group": "navigation@9"
},
{
"command": "gitlens.repositoriesExplorer.setFilesLayoutToAuto",
"when": "view =~ /^gitlens.repositoriesExplorer:/",
"group": "1_gitlens"

+ 28
- 0
src/views/nodes/repositoriesNode.ts Zobrazit soubor

@ -84,6 +84,34 @@ export class RepositoriesNode extends SubscribeableExplorerNode
);
}
async pullAll() {
if (this._children === undefined || this._children.length === 0) return;
const children = this._children;
await window.withProgress(
{
location: ProgressLocation.Notification,
title: `Pulling repositories`,
cancellable: false
},
async progress => {
const total = children.length + 1;
let i = 0;
for (const node of children) {
if (node instanceof MessageNode) continue;
i++;
progress.report({
message: `${node.repo.formattedName}...`,
increment: (i / total) * 100
});
await node.pull(false);
}
}
);
}
async refresh() {
if (this._children === undefined) return;

+ 11
- 1
src/views/repositoriesExplorer.ts Zobrazit soubor

@ -26,6 +26,7 @@ export class RepositoriesExplorer extends ExplorerBase {
Container.explorerCommands;
commands.registerCommand(this.getQualifiedCommand('fetchAll'), () => this.fetchAll(), this);
commands.registerCommand(this.getQualifiedCommand('pullAll'), () => this.pullAll(), this);
commands.registerCommand(this.getQualifiedCommand('refresh'), () => this.refresh(), this);
commands.registerCommand(
@ -111,6 +112,12 @@ export class RepositoriesExplorer extends ExplorerBase {
return this._root.fetchAll();
}
private pullAll() {
if (this._root === undefined) return;
return this._root.pullAll();
}
private async setAutoRefresh(enabled: boolean, workspaceEnabled?: boolean) {
if (enabled) {
if (workspaceEnabled === undefined) {
@ -133,6 +140,9 @@ export class RepositoriesExplorer extends ExplorerBase {
}
private setFilesLayout(layout: ExplorerFilesLayout) {
return configuration.updateEffective(configuration.name('repositoriesExplorer')('files')('layout').value, layout);
return configuration.updateEffective(
configuration.name('repositoriesExplorer')('files')('layout').value,
layout
);
}
}

Načítá se…
Zrušit
Uložit