@@ -36,18 +36,19 @@ interface IGitState {
36
36
export class GitExtension implements IGitExtension {
37
37
constructor (
38
38
app : JupyterFrontEnd = null ,
39
- settings ? : ISettingRegistry . ISettings ,
40
- state ? : IStateDB
39
+ settings : ISettingRegistry . ISettings = null ,
40
+ state : IStateDB = null
41
41
) {
42
42
const model = this ;
43
43
this . _app = app ;
44
+ this . _stateDB = state ;
44
45
45
- // Load state extension
46
46
this . _state = {
47
47
isRepositoryPin : false ,
48
48
pathRepository : null
49
49
} ;
50
50
51
+ // Load state extension
51
52
this . _restored = app . restored . then ( ( ) => {
52
53
if ( state ) {
53
54
return state
@@ -111,19 +112,17 @@ export class GitExtension implements IGitExtension {
111
112
* @param settings - settings registry
112
113
*/
113
114
function onSettingsChange ( settings : ISettingRegistry . ISettings ) {
114
- const freq = poll . frequency ;
115
115
poll . frequency = {
116
- interval : settings . composite . refreshInterval as number ,
117
- backoff : freq . backoff ,
118
- max : freq . max
116
+ ...poll . frequency ,
117
+ interval : settings . composite . refreshInterval as number
119
118
} ;
120
119
}
121
120
}
122
121
123
122
/**
124
123
* The list of branch in the current repo
125
124
*/
126
- get branches ( ) {
125
+ get branches ( ) : Git . IBranch [ ] {
127
126
return this . _branches ;
128
127
}
129
128
@@ -134,7 +133,7 @@ export class GitExtension implements IGitExtension {
134
133
/**
135
134
* The current branch
136
135
*/
137
- get currentBranch ( ) {
136
+ get currentBranch ( ) : Git . IBranch | null {
138
137
return this . _currentBranch ;
139
138
}
140
139
@@ -391,7 +390,9 @@ export class GitExtension implements IGitExtension {
391
390
* @param mark Mark to set
392
391
*/
393
392
addMark ( fname : string , mark : boolean ) {
394
- this . _currentMarker . add ( fname , mark ) ;
393
+ if ( this . _currentMarker ) {
394
+ this . _currentMarker . add ( fname , mark ) ;
395
+ }
395
396
}
396
397
397
398
/**
@@ -401,7 +402,11 @@ export class GitExtension implements IGitExtension {
401
402
* @returns Mark of the file
402
403
*/
403
404
getMark ( fname : string ) : boolean {
404
- return this . _currentMarker . get ( fname ) ;
405
+ if ( this . _currentMarker ) {
406
+ return this . _currentMarker . get ( fname ) ;
407
+ } else {
408
+ return false ;
409
+ }
405
410
}
406
411
407
412
/**
@@ -410,7 +415,9 @@ export class GitExtension implements IGitExtension {
410
415
* @param fname Filename
411
416
*/
412
417
toggleMark ( fname : string ) {
413
- this . _currentMarker . toggle ( fname ) ;
418
+ if ( this . _currentMarker ) {
419
+ this . _currentMarker . toggle ( fname ) ;
420
+ }
414
421
}
415
422
416
423
/**
@@ -1079,27 +1086,27 @@ export class GitExtension implements IGitExtension {
1079
1086
return this . _currentMarker ;
1080
1087
}
1081
1088
1082
- private _status : Git . IStatusFileResult [ ] = [ ] ;
1083
- private _branches : Git . IBranch [ ] ;
1084
- private _currentBranch : Git . IBranch ;
1085
- private _serverRoot : string ;
1086
1089
private _app : JupyterFrontEnd | null ;
1090
+ private _branches : Git . IBranch [ ] = [ ] ;
1091
+ private _currentBranch : Git . IBranch | null = null ;
1092
+ private _currentMarker : BranchMarker = null ;
1087
1093
private _diffProviders : { [ key : string ] : Git . IDiffCallback } = { } ;
1094
+ private _headChanged = new Signal < IGitExtension , void > ( this ) ;
1088
1095
private _isDisposed = false ;
1089
1096
private _markerCache : Markers = new Markers ( ( ) => this . _markChanged . emit ( ) ) ;
1090
- private _currentMarker : BranchMarker = null ;
1091
- private _readyPromise : Promise < void > = Promise . resolve ( ) ;
1097
+ private _markChanged = new Signal < IGitExtension , void > ( this ) ;
1092
1098
private _pendingReadyPromise = 0 ;
1093
1099
private _poll : Poll ;
1094
- private _headChanged = new Signal < IGitExtension , void > ( this ) ;
1095
- private _markChanged = new Signal < IGitExtension , void > ( this ) ;
1100
+ private _readyPromise : Promise < void > = Promise . resolve ( ) ;
1096
1101
private _repositoryChanged = new Signal <
1097
1102
IGitExtension ,
1098
1103
IChangedArgs < string | null >
1099
1104
> ( this ) ;
1100
1105
private _restored : Promise < void > ;
1106
+ private _serverRoot : string ;
1101
1107
private _state : IGitState ;
1102
1108
private _stateDB : IStateDB | null = null ;
1109
+ private _status : Git . IStatusFileResult [ ] = [ ] ;
1103
1110
private _statusChanged = new Signal < IGitExtension , Git . IStatusFileResult [ ] > (
1104
1111
this
1105
1112
) ;
0 commit comments