@@ -14,7 +14,10 @@ interface IRepositoryWatcher : IDisposable
14
14
event Action HeadChanged ;
15
15
event Action IndexChanged ;
16
16
event Action ConfigChanged ;
17
+ event Action RepositoryCommitted ;
17
18
event Action RepositoryChanged ;
19
+ event Action LocalBranchesChanged ;
20
+ event Action RemoteBranchesChanged ;
18
21
void Initialize ( ) ;
19
22
int CheckAndProcessEvents ( ) ;
20
23
}
@@ -34,7 +37,10 @@ class RepositoryWatcher : IRepositoryWatcher
34
37
public event Action HeadChanged ;
35
38
public event Action IndexChanged ;
36
39
public event Action ConfigChanged ;
40
+ public event Action RepositoryCommitted ;
37
41
public event Action RepositoryChanged ;
42
+ public event Action LocalBranchesChanged ;
43
+ public event Action RemoteBranchesChanged ;
38
44
39
45
public RepositoryWatcher ( IPlatform platform , RepositoryPathConfiguration paths , CancellationToken cancellationToken )
40
46
{
@@ -183,13 +189,13 @@ private int ProcessEvents(Event[] fileEvents)
183
189
{
184
190
events . Add ( EventType . IndexChanged , null ) ;
185
191
}
186
- else if ( fileA . IsChildOf ( paths . RemotesPath ) )
192
+ else if ( ! events . ContainsKey ( EventType . RemoteBranchesChanged ) && fileA . IsChildOf ( paths . RemotesPath ) )
187
193
{
188
- throw new NotImplementedException ( ) ;
194
+ events . Add ( EventType . RemoteBranchesChanged , null ) ;
189
195
}
190
- else if ( fileA . IsChildOf ( paths . BranchesPath ) )
196
+ else if ( ! events . ContainsKey ( EventType . LocalBranchesChanged ) && fileA . IsChildOf ( paths . BranchesPath ) )
191
197
{
192
- throw new NotImplementedException ( ) ;
198
+ events . Add ( EventType . LocalBranchesChanged , null ) ;
193
199
}
194
200
}
195
201
else
@@ -205,13 +211,6 @@ private int ProcessEvents(Event[] fileEvents)
205
211
return FireEvents ( events ) ;
206
212
}
207
213
208
- private void AddOrUpdateEventData ( Dictionary < EventType , List < EventData > > events , EventType type , EventData data )
209
- {
210
- if ( ! events . ContainsKey ( type ) )
211
- events . Add ( type , new List < EventData > ( ) ) ;
212
- events [ type ] . Add ( data ) ;
213
- }
214
-
215
214
private int FireEvents ( Dictionary < EventType , List < EventData > > events )
216
215
{
217
216
int eventsProcessed = 0 ;
@@ -229,6 +228,20 @@ private int FireEvents(Dictionary<EventType, List<EventData>> events)
229
228
eventsProcessed ++ ;
230
229
}
231
230
231
+ if ( events . ContainsKey ( EventType . LocalBranchesChanged ) )
232
+ {
233
+ Logger . Trace ( "LocalBranchesChanged" ) ;
234
+ LocalBranchesChanged ? . Invoke ( ) ;
235
+ eventsProcessed ++ ;
236
+ }
237
+
238
+ if ( events . ContainsKey ( EventType . RemoteBranchesChanged ) )
239
+ {
240
+ Logger . Trace ( "RemoteBranchesChanged" ) ;
241
+ RemoteBranchesChanged ? . Invoke ( ) ;
242
+ eventsProcessed ++ ;
243
+ }
244
+
232
245
if ( events . ContainsKey ( EventType . IndexChanged ) )
233
246
{
234
247
Logger . Trace ( "IndexChanged" ) ;
@@ -276,8 +289,10 @@ private enum EventType
276
289
None ,
277
290
ConfigChanged ,
278
291
HeadChanged ,
279
- RepositoryChanged ,
280
292
IndexChanged ,
293
+ LocalBranchesChanged ,
294
+ RemoteBranchesChanged ,
295
+ RepositoryChanged ,
281
296
}
282
297
283
298
private class EventData
0 commit comments