Skip to content

Commit 3c12952

Browse files
committed
fixed some typos and stopped the source control view from flashing on update
1 parent a2439cf commit 3c12952

File tree

2 files changed

+77
-80
lines changed

2 files changed

+77
-80
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
=============================================
8080

8181
## Bug Fixes
82-
- Updated incorrect information in pagage.json
82+
- Updated incorrect information in package.json
8383

8484
**v0.1.1**
8585
=============================================
@@ -91,4 +91,4 @@
9191
=============================================
9292

9393
## What's New
94-
- Added Soruce control view
94+
- Added Source control view

src/repository.js

Lines changed: 75 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -3,100 +3,97 @@ const Resource = require("./Resource");
33
const { throttleAsync } = require("./decorators");
44

55
function Repository(repository) {
6-
this.repository = repository;
7-
this.root = repository.root;
8-
this.watcher = workspace.createFileSystemWatcher(this.root + "/**/*");
9-
this.sourceControl = scm.createSourceControl(
10-
"svn",
11-
"svn",
12-
Uri.parse(this.root)
13-
);
14-
this.sourceControl.acceptInputCommand = {
15-
command: "svn.commitWithMessage",
16-
title: "commit",
17-
arguments: [this]
18-
};
19-
this.sourceControl.quickDiffProvider = this;
20-
this.repository.inputBox = this.sourceControl.inputBox;
6+
this.repository = repository;
7+
this.root = repository.root;
8+
this.watcher = workspace.createFileSystemWatcher(this.root + "/**/*");
9+
this.sourceControl = scm.createSourceControl(
10+
"svn",
11+
"svn",
12+
Uri.parse(this.root)
13+
);
14+
this.sourceControl.acceptInputCommand = {
15+
command: "svn.commitWithMessage",
16+
title: "commit",
17+
arguments: [this]
18+
};
19+
this.sourceControl.quickDiffProvider = this;
20+
this.repository.inputBox = this.sourceControl.inputBox;
2121

22-
this.changes = this.sourceControl.createResourceGroup("changes", "Changes");
23-
this.notTracked = this.sourceControl.createResourceGroup(
24-
"unversioned",
25-
"Not Tracked"
26-
);
22+
this.changes = this.sourceControl.createResourceGroup("changes", "Changes");
23+
this.notTracked = this.sourceControl.createResourceGroup(
24+
"unversioned",
25+
"Not Tracked"
26+
);
2727

28-
this.changes.hideWhenEmpty = true;
29-
this.notTracked.hideWhenEmpty = true;
28+
this.changes.hideWhenEmpty = true;
29+
this.notTracked.hideWhenEmpty = true;
3030

31-
this.update();
32-
this.addEventListeners();
31+
this.update();
32+
this.addEventListeners();
3333
}
3434

35-
Repository.prototype.addEventListeners = function() {
36-
this.watcher.onDidChange(throttleAsync(this.update, "update", this));
37-
this.watcher.onDidCreate(throttleAsync(this.update, "update", this));
38-
this.watcher.onDidDelete(throttleAsync(this.update, "update", this));
35+
Repository.prototype.addEventListeners = function () {
36+
this.watcher.onDidChange(throttleAsync(this.update, "update", this));
37+
this.watcher.onDidCreate(throttleAsync(this.update, "update", this));
38+
this.watcher.onDidDelete(throttleAsync(this.update, "update", this));
3939
};
4040

4141
Repository.prototype.provideOriginalResource = uri => {
42-
if (uri.scheme !== "file") {
43-
return;
44-
}
42+
if (uri.scheme !== "file") {
43+
return;
44+
}
4545

46-
return new Uri().with({ scheme: "svn", query: uri.path, path: uri.path });
46+
return new Uri().with({ scheme: "svn", query: uri.path, path: uri.path });
4747
};
4848

49-
Repository.prototype.update = function() {
50-
return new Promise((resolve, reject) => {
51-
let changes = [];
52-
let notTracked = [];
53-
54-
this.changes.resourceStates = [];
55-
this.notTracked.resourceStates = [];
56-
57-
this.repository
58-
.getStatus()
59-
.then(result => {
49+
Repository.prototype.update = function () {
50+
return new Promise((resolve, reject) => {
6051
let changes = [];
6152
let notTracked = [];
6253

63-
result.forEach(item => {
64-
switch (item["wc-status"].$.item) {
65-
case "modified":
66-
case "deleted":
67-
case "conflicted":
68-
case "replaced":
69-
case "missing":
70-
case "added":
71-
changes.push(
72-
new Resource(
73-
this.repository.root,
74-
item.$.path,
75-
item["wc-status"].$.item
76-
)
77-
);
78-
break;
79-
case "unversioned":
80-
notTracked.push(
81-
new Resource(
82-
this.repository.root,
83-
item.$.path,
84-
item["wc-status"].$.item
85-
)
86-
);
87-
break;
88-
}
89-
});
54+
this.repository
55+
.getStatus()
56+
.then(result => {
57+
let changes = [];
58+
let notTracked = [];
59+
60+
result.forEach(item => {
61+
switch (item["wc-status"].$.item) {
62+
case "modified":
63+
case "deleted":
64+
case "conflicted":
65+
case "replaced":
66+
case "missing":
67+
case "added":
68+
changes.push(
69+
new Resource(
70+
this.repository.root,
71+
item.$.path,
72+
item["wc-status"].$.item
73+
)
74+
);
75+
break;
76+
case "unversioned":
77+
notTracked.push(
78+
new Resource(
79+
this.repository.root,
80+
item.$.path,
81+
item["wc-status"].$.item
82+
)
83+
);
84+
break;
85+
}
86+
});
9087

91-
this.changes.resourceStates = changes;
92-
this.notTracked.resourceStates = notTracked;
88+
this.changes.resourceStates = changes;
89+
this.notTracked.resourceStates = notTracked;
9390

94-
resolve();
95-
})
96-
.catch(error => {
97-
reject();
98-
});
99-
});
91+
resolve();
92+
})
93+
.catch(error => {
94+
reject();
95+
});
96+
});
10097
};
10198

10299
module.exports = Repository;

0 commit comments

Comments
 (0)