Ver a proveniência

Executes multi-repo commands in order

main
Eric Amodio há 6 anos
ascendente
cometimento
08e31f1fbc
2 ficheiros alterados com 14 adições e 7 eliminações
  1. +10
    -3
      src/git/gitService.ts
  2. +4
    -4
      src/views/nodes/repositoriesNode.ts

+ 10
- 3
src/git/gitService.ts Ver ficheiro

@ -473,7 +473,7 @@ export class GitService implements Disposable {
@gate()
@log()
async fetchAll() {
const repositories = [...(await this.getRepositories())];
const repositories = await this.getOrderedRepositories();
if (repositories.length === 0) return;
await window.withProgress(
@ -503,7 +503,7 @@ export class GitService implements Disposable {
@gate()
@log()
async pullAll() {
const repositories = [...(await this.getRepositories())];
const repositories = await this.getOrderedRepositories();
if (repositories.length === 0) return;
await window.withProgress(
@ -533,7 +533,7 @@ export class GitService implements Disposable {
@gate()
@log()
async pushAll() {
const repositories = [...(await this.getRepositories())];
const repositories = await this.getOrderedRepositories();
if (repositories.length === 0) return;
await window.withProgress(
@ -1703,6 +1703,13 @@ export class GitService implements Disposable {
return predicate !== undefined ? Iterables.filter(values, predicate) : values;
}
async getOrderedRepositories(): Promise<Repository[]> {
const repositories = [...(await this.getRepositories())];
if (repositories.length === 0) return repositories;
return repositories.sort((a, b) => a.index - b.index);
}
private async getRepositoryTree(): Promise<TernarySearchTree<Repository>> {
if (this._repositoriesLoadingPromise !== undefined) {
await this._repositoriesLoadingPromise;

+ 4
- 4
src/views/nodes/repositoriesNode.ts Ver ficheiro

@ -32,11 +32,11 @@ export class RepositoriesNode extends SubscribeableViewNode {
async getChildren(): Promise<ViewNode[]> {
if (this._children === undefined) {
const repositories = [...(await Container.git.getRepositories())];
const repositories = await Container.git.getOrderedRepositories();
if (repositories.length === 0) return [new MessageNode(this, 'No repositories could be found.')];
const children = [];
for (const repo of repositories.sort((a, b) => a.index - b.index)) {
for (const repo of repositories) {
if (repo.closed) continue;
children.push(new RepositoryNode(GitUri.fromRepoPath(repo.path), repo, this, this.view));
@ -62,7 +62,7 @@ export class RepositoriesNode extends SubscribeableViewNode {
async refresh(reason?: RefreshReason) {
if (this._children === undefined) return;
const repositories = [...(await Container.git.getRepositories())];
const repositories = await Container.git.getOrderedRepositories();
if (repositories.length === 0 && (this._children === undefined || this._children.length === 0)) return;
if (repositories.length === 0) {
@ -71,7 +71,7 @@ export class RepositoriesNode extends SubscribeableViewNode {
}
const children = [];
for (const repo of repositories.sort((a, b) => a.index - b.index)) {
for (const repo of repositories) {
const normalizedPath = repo.normalizedPath;
const child = (this._children as RepositoryNode[]).find(c => c.repo.normalizedPath === normalizedPath);
if (child !== undefined) {

Carregando…
Cancelar
Guardar