Skip to content

Commit be16c7f

Browse files
Refactor code to say newCommits
1 parent 03d2531 commit be16c7f

File tree

4 files changed

+23
-24
lines changed

4 files changed

+23
-24
lines changed

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,11 +360,10 @@
360360
"How frequently (in minutes) to check branch changes. Set to `0` to avoid periodic checks.",
361361
"default": 5
362362
},
363-
"svn.newsCommits.update": {
363+
"svn.newCommits.update": {
364364
"type": "number",
365365
"minimum": 0,
366-
"description":
367-
"How frequently (in minutes) to check news commits. Set to `0` to avoid periodic checks.",
366+
"description": "How frequently (in minutes) to check for new commits. Set to `0` to avoid periodic checks.",
368367
"default": 5
369368
},
370369
"svn.multipleFolders.enabled": {

src/repository.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class Repository {
4040
public isUpdatingRevision: boolean = false;
4141
public branches: any[] = [];
4242
public branchesTimer: NodeJS.Timer;
43-
public newsCommit: number = 0;
43+
public newCommits: number = 0;
4444

4545
private _onDidChangeRepository = new EventEmitter<Uri>();
4646
readonly onDidChangeRepository: Event<Uri> = this._onDidChangeRepository
@@ -52,8 +52,8 @@ export class Repository {
5252
private _onDidChangeBranch = new EventEmitter<void>();
5353
readonly onDidChangeBranch: Event<void> = this._onDidChangeBranch.event;
5454

55-
private _onDidChangeNewsCommit = new EventEmitter<void>();
56-
readonly onDidChangeNewsCommit: Event<void> = this._onDidChangeNewsCommit
55+
private _onDidChangeNewCommits = new EventEmitter<void>();
56+
readonly onDidChangeNewCommits: Event<void> = this._onDidChangeNewCommits
5757
.event;
5858

5959
get root(): string {
@@ -171,15 +171,15 @@ export class Repository {
171171
}, 1000 * 60 * updateFreq);
172172
}
173173

174-
const updateFreqNews = svnConfig.get<number>("svn.newsCommits.update");
175-
if (updateFreqNews) {
174+
const updateFreqNewCommits = svnConfig.get<number>("svn.newCommits.update");
175+
if (updateFreqNewCommits) {
176176
setInterval(() => {
177-
this.updateNewsCommits();
178-
}, 1000 * 60 * updateFreqNews);
177+
this.updateNewCommits();
178+
}, 1000 * 60 * updateFreqNewCommits);
179179
}
180180

181181
this.updateBranches();
182-
this.updateNewsCommits();
182+
this.updateNewCommits();
183183
this.update();
184184
}
185185

@@ -193,11 +193,11 @@ export class Repository {
193193
}
194194

195195
@debounce(1000)
196-
async updateNewsCommits() {
197-
const newsCommit = await this.repository.countNewsCommit();
198-
if (newsCommit !== this.newsCommit) {
199-
this.newsCommit = newsCommit;
200-
this._onDidChangeNewsCommit.fire();
196+
async updateNewCommits() {
197+
const newCommits = await this.repository.countNewCommits();
198+
if (newCommits !== this.newCommits) {
199+
this.newCommits = newCommits;
200+
this._onDidChangeNewCommits.fire();
201201
}
202202
}
203203

@@ -385,7 +385,7 @@ export class Repository {
385385
this.isSwitchingBranch = false;
386386
this.updateBranches();
387387
this._onDidChangeBranch.fire();
388-
this.updateNewsCommits()
388+
this.updateNewCommits()
389389
return response;
390390
}
391391

@@ -410,15 +410,15 @@ export class Repository {
410410
this.isSwitchingBranch = false;
411411
this.updateBranches();
412412
this._onDidChangeBranch.fire();
413-
this.updateNewsCommits()
413+
this.updateNewCommits()
414414
}
415415
}
416416

417417
async updateRevision() {
418418
this.isUpdatingRevision = true;
419419
const response = await this.repository.update();
420420
this.isUpdatingRevision = false;
421-
this.updateNewsCommits();
421+
this.updateNewCommits();
422422
return response;
423423
}
424424

src/statusBar.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class SvnStatusBar {
3131
null,
3232
this.disposables
3333
);
34-
repository.onDidChangeNewsCommit(
34+
repository.onDidChangeNewCommits(
3535
this._onDidChange.fire,
3636
this._onDidChange,
3737
this.disposables
@@ -55,9 +55,9 @@ export class SvnStatusBar {
5555

5656
const icon = this.repository.isUpdatingRevision ? "sync~spin" : "sync";
5757
const title =
58-
this.repository.newsCommit > 0
59-
? `${this.repository.newsCommit} news commits`
60-
: "Updated";
58+
this.repository.newCommits > 0
59+
? `${this.repository.newCommits} new commits`
60+
: "No new commits";
6161

6262
result.push({
6363
command: "svn.update",

src/svnRepository.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ export class Repository {
323323
return result.stdout;
324324
}
325325

326-
async countNewsCommit(revision: string = "BASE:HEAD") {
326+
async countNewCommits(revision: string = "BASE:HEAD") {
327327
const result = await this.svn.exec(this.workspaceRoot, [
328328
"log",
329329
"-r",

0 commit comments

Comments
 (0)