Skip to content

Commit 01e1e58

Browse files
Merge branch 'master' into added_checkout
2 parents 00975f2 + 81ee460 commit 01e1e58

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

src/repository.ts

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,11 @@ export class Repository {
235235
this.conflicts.hideWhenEmpty = true;
236236

237237
this.disposables.push(this.changes);
238-
this.disposables.push(this.unversioned);
239238
this.disposables.push(this.conflicts);
240239

240+
// The this.unversioned can recreated by update state model
241+
this.disposables.push(toDisposable(() => this.unversioned.dispose()));
242+
241243
// Dispose the setInterval of Remote Changes
242244
this.disposables.push(
243245
toDisposable(() => {
@@ -585,9 +587,10 @@ export class Repository {
585587
}
586588

587589
this.changes.resourceStates = changes;
588-
this.unversioned.resourceStates = unversioned;
589590
this.conflicts.resourceStates = conflicts;
590591

592+
const prevChangelistsSize = this.changelists.size;
593+
591594
this.changelists.forEach((group, changelist) => {
592595
group.resourceStates = [];
593596
});
@@ -623,6 +626,20 @@ export class Repository {
623626
}
624627
});
625628

629+
// Recreate unversioned group to move after changelists
630+
if (prevChangelistsSize !== this.changelists.size) {
631+
this.unversioned.dispose();
632+
633+
this.unversioned = this.sourceControl.createResourceGroup(
634+
"unversioned",
635+
"Unversioned"
636+
) as ISvnResourceGroup;
637+
638+
this.unversioned.hideWhenEmpty = true;
639+
}
640+
641+
this.unversioned.resourceStates = unversioned;
642+
626643
if (configuration.get<boolean>("sourceControl.countUnversioned", false)) {
627644
counts.push(this.unversioned);
628645
}
@@ -632,11 +649,14 @@ export class Repository {
632649
0
633650
);
634651

635-
if (checkRemoteChanges) {
652+
// Recreate remoteChanges group to move after unversioned
653+
if (!this.remoteChanges || prevChangelistsSize !== this.changelists.size) {
636654
/**
637655
* Destroy and create for keep at last position
638656
*/
657+
let tempResourceStates: Resource[] = [];
639658
if (this.remoteChanges) {
659+
tempResourceStates = this.remoteChanges.resourceStates;
640660
this.remoteChanges.dispose();
641661
}
642662

@@ -646,6 +666,11 @@ export class Repository {
646666
) as ISvnResourceGroup;
647667

648668
this.remoteChanges.hideWhenEmpty = true;
669+
this.remoteChanges.resourceStates = tempResourceStates;
670+
}
671+
672+
// Update remote changes group
673+
if (checkRemoteChanges) {
649674
this.remoteChanges.resourceStates = remoteChanges;
650675

651676
if (remoteChanges.length !== this.remoteChangedFiles) {

0 commit comments

Comments
 (0)