Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions src/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,11 @@ export class Repository {
this.conflicts.hideWhenEmpty = true;

this.disposables.push(this.changes);
this.disposables.push(this.unversioned);
this.disposables.push(this.conflicts);

// The this.unversioned can recreated by update state model
this.disposables.push(toDisposable(() => this.unversioned.dispose()));

// Dispose the setInterval of Remote Changes
this.disposables.push(
toDisposable(() => {
Expand Down Expand Up @@ -584,9 +586,10 @@ export class Repository {
}

this.changes.resourceStates = changes;
this.unversioned.resourceStates = unversioned;
this.conflicts.resourceStates = conflicts;

const prevChangelistsSize = this.changelists.size;

this.changelists.forEach((group, changelist) => {
group.resourceStates = [];
});
Expand Down Expand Up @@ -622,6 +625,20 @@ export class Repository {
}
});

// Recreate unversioned group to move after changelists
if (prevChangelistsSize !== this.changelists.size) {
this.unversioned.dispose();

this.unversioned = this.sourceControl.createResourceGroup(
"unversioned",
"Unversioned"
) as ISvnResourceGroup;

this.unversioned.hideWhenEmpty = true;
}

this.unversioned.resourceStates = unversioned;

if (configuration.get<boolean>("sourceControl.countUnversioned", false)) {
counts.push(this.unversioned);
}
Expand All @@ -631,11 +648,14 @@ export class Repository {
0
);

if (checkRemoteChanges) {
// Recreate remoteChanges group to move after unversioned
if (!this.remoteChanges || prevChangelistsSize !== this.changelists.size) {
/**
* Destroy and create for keep at last position
*/
let tempResourceStates: Resource[] = [];
if (this.remoteChanges) {
tempResourceStates = this.remoteChanges.resourceStates;
this.remoteChanges.dispose();
}

Expand All @@ -645,6 +665,11 @@ export class Repository {
) as ISvnResourceGroup;

this.remoteChanges.hideWhenEmpty = true;
this.remoteChanges.resourceStates = tempResourceStates;
}

// Update remote changes group
if (checkRemoteChanges) {
this.remoteChanges.resourceStates = remoteChanges;

if (remoteChanges.length !== this.remoteChangedFiles) {
Expand Down