Преглед изворни кода

Executes multi-repo commands in order

main
Eric Amodio пре 6 година
родитељ
комит
08e31f1fbc
2 измењених фајлова са 14 додато и 7 уклоњено
  1. +10
    -3
      src/git/gitService.ts
  2. +4
    -4
      src/views/nodes/repositoriesNode.ts

+ 10
- 3
src/git/gitService.ts Прегледај датотеку

@ -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 Прегледај датотеку

@ -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) {

Loading…
Откажи
Сачувај