@@ -49,7 +49,9 @@ public void Initialize(IRepositoryManager initRepositoryManager)
4949 repositoryManager = initRepositoryManager ;
5050 repositoryManager . CurrentBranchUpdated += RepositoryManagerOnCurrentBranchUpdated ;
5151 repositoryManager . GitStatusUpdated += RepositoryManagerOnGitStatusUpdated ;
52+ repositoryManager . GitAheadBehindStatusUpdated += RepositoryManagerOnGitAheadBehindStatusUpdated ;
5253 repositoryManager . GitLogUpdated += RepositoryManagerOnGitLogUpdated ;
54+ repositoryManager . GitLocksUpdated += RepositoryManagerOnGitLocksUpdated ;
5355 repositoryManager . LocalBranchesUpdated += RepositoryManagerOnLocalBranchesUpdated ;
5456 repositoryManager . RemoteBranchesUpdated += RepositoryManagerOnRemoteBranchesUpdated ;
5557 }
@@ -266,7 +268,7 @@ private void CacheContainer_OnCacheInvalidated(CacheType cacheType)
266268 break ;
267269
268270 case CacheType . GitLocksCache :
269- repositoryManager ? . UpdateLocks ( ) ;
271+ UpdateLocks ( ) ;
270272 break ;
271273
272274 case CacheType . GitUserCache :
@@ -352,26 +354,36 @@ private void RepositoryManagerOnCurrentBranchUpdated(ConfigBranch? branch, Confi
352354 new ActionTask ( CancellationToken . None , ( ) => {
353355 if ( ! Nullable . Equals ( CurrentConfigBranch , branch ) )
354356 {
355- var currentBranch = branch != null ? ( GitBranch ? ) GetLocalGitBranch ( branch . Value ) : null ;
357+ var currentBranch = branch != null ? ( GitBranch ? ) GetLocalGitBranch ( branch . Value ) : null ;
356358
357- CurrentConfigBranch = branch ;
358- CurrentBranch = currentBranch ;
359- UpdateLocalBranches ( ) ;
359+ CurrentConfigBranch = branch ;
360+ CurrentBranch = currentBranch ;
361+ UpdateLocalBranches ( ) ;
360362 }
361363
362364 if ( ! Nullable . Equals ( CurrentConfigRemote , remote ) )
363365 {
364- CurrentConfigRemote = remote ;
365- CurrentRemote = GetGitRemote ( remote . Value ) ;
366- ClearRepositoryInfo ( ) ;
366+ CurrentConfigRemote = remote ;
367+ CurrentRemote = remote . HasValue ? ( GitRemote ? ) GetGitRemote ( remote . Value ) : null ;
368+ ClearRepositoryInfo ( ) ;
367369 }
368370 } ) { Affinity = TaskAffinity . UI } . Start ( ) ;
369371 }
370372
371373 private void RepositoryManagerOnGitStatusUpdated ( GitStatus gitStatus )
372374 {
373375 new ActionTask ( CancellationToken . None , ( ) => {
374- CurrentStatus = gitStatus ;
376+ CurrentChanges = gitStatus . Entries ;
377+ CurrentAhead = gitStatus . Ahead ;
378+ CurrentBehind = gitStatus . Behind ;
379+ } ) { Affinity = TaskAffinity . UI } . Start ( ) ;
380+ }
381+
382+ private void RepositoryManagerOnGitAheadBehindStatusUpdated ( GitAheadBehindStatus aheadBehindStatus )
383+ {
384+ new ActionTask ( CancellationToken . None , ( ) => {
385+ CurrentAhead = aheadBehindStatus . Ahead ;
386+ CurrentBehind = aheadBehindStatus . Behind ;
375387 } ) { Affinity = TaskAffinity . UI } . Start ( ) ;
376388 }
377389
@@ -382,6 +394,14 @@ private void RepositoryManagerOnGitLogUpdated(List<GitLogEntry> gitLogEntries)
382394 } ) { Affinity = TaskAffinity . UI } . Start ( ) ;
383395 }
384396
397+ private void RepositoryManagerOnGitLocksUpdated ( List < GitLock > gitLocks )
398+ {
399+ new ActionTask ( CancellationToken . None , ( ) => {
400+ CurrentLocks = gitLocks ;
401+ } )
402+ { Affinity = TaskAffinity . UI } . Start ( ) ;
403+ }
404+
385405 private void RepositoryManagerOnRemoteBranchesUpdated ( Dictionary < string , ConfigRemote > remotes ,
386406 Dictionary < string , Dictionary < string , ConfigBranch > > branches )
387407 {
@@ -400,6 +420,14 @@ private void RepositoryManagerOnLocalBranchesUpdated(Dictionary<string, ConfigBr
400420 } ) { Affinity = TaskAffinity . UI } . Start ( ) ;
401421 }
402422
423+ private void UpdateLocks ( )
424+ {
425+ if ( CurrentRemote . HasValue )
426+ {
427+ repositoryManager ? . UpdateLocks ( ) ;
428+ }
429+ }
430+
403431 private void UpdateLocalBranches ( )
404432 {
405433 LocalBranches = LocalConfigBranches . Values . Select ( GetLocalGitBranch ) . ToArray ( ) ;
@@ -468,10 +496,22 @@ private ConfigRemote? CurrentConfigRemote
468496 set { cacheContainer . BranchCache . CurrentConfigRemote = value ; }
469497 }
470498
471- public GitStatus CurrentStatus
499+ public int CurrentAhead
500+ {
501+ get { return cacheContainer . GitStatusCache . Ahead ; }
502+ private set { cacheContainer . GitStatusCache . Ahead = value ; }
503+ }
504+
505+ public int CurrentBehind
506+ {
507+ get { return cacheContainer . GitStatusCache . Behind ; }
508+ private set { cacheContainer . GitStatusCache . Behind = value ; }
509+ }
510+
511+ public List < GitStatusEntry > CurrentChanges
472512 {
473- get { return cacheContainer . GitStatusCache . GitStatus ; }
474- private set { cacheContainer . GitStatusCache . GitStatus = value ; }
513+ get { return cacheContainer . GitStatusCache . Entries ; }
514+ private set { cacheContainer . GitStatusCache . Entries = value ; }
475515 }
476516
477517 public GitBranch ? CurrentBranch
0 commit comments