diff --git a/src/GitHub.Api/Cache/CacheInterfaces.cs b/src/GitHub.Api/Cache/CacheInterfaces.cs index 0d666d684..810db7774 100644 --- a/src/GitHub.Api/Cache/CacheInterfaces.cs +++ b/src/GitHub.Api/Cache/CacheInterfaces.cs @@ -84,20 +84,16 @@ public interface IConfigRemoteDictionary : IDictionary public interface IBranchCache : IManagedCache { - GitBranch[] LocalBranches { get; set; } - GitBranch[] RemoteBranches { get; set; } - GitRemote[] Remotes { get; set; } + GitBranch[] LocalBranches { get; } + GitBranch[] RemoteBranches { get; } + GitRemote[] Remotes { get; } ILocalConfigBranchDictionary LocalConfigBranches { get; } IRemoteConfigBranchDictionary RemoteConfigBranches { get; } IConfigRemoteDictionary ConfigRemotes { get; } - void RemoveLocalBranch(string branch); - void AddLocalBranch(string branch); - void AddRemoteBranch(string remote, string branch); - void RemoveRemoteBranch(string remote, string branch); - void SetRemotes(Dictionary remoteDictionary, Dictionary> branchDictionary); - void SetLocals(Dictionary branchDictionary); + void SetRemotes(Dictionary remoteConfigs, Dictionary> configBranches, GitRemote[] gitRemotes, GitBranch[] gitBranches); + void SetLocals(Dictionary configBranches, GitBranch[] gitBranches); } public interface IRepositoryInfoCacheData diff --git a/src/GitHub.Api/Git/GitBranch.cs b/src/GitHub.Api/Git/GitBranch.cs index d6d38a4f2..857212810 100644 --- a/src/GitHub.Api/Git/GitBranch.cs +++ b/src/GitHub.Api/Git/GitBranch.cs @@ -9,15 +9,13 @@ public struct GitBranch public string name; public string tracking; - public bool isActive; - public GitBranch(string name, string tracking, bool active) + public GitBranch(string name, string tracking) { Guard.ArgumentNotNullOrWhiteSpace(name, "name"); this.name = name; this.tracking = tracking; - this.isActive = active; } public override int GetHashCode() @@ -25,7 +23,6 @@ public override int GetHashCode() int hash = 17; hash = hash * 23 + (name?.GetHashCode() ?? 0); hash = hash * 23 + (tracking?.GetHashCode() ?? 0); - hash = hash * 23 + isActive.GetHashCode(); return hash; } @@ -40,8 +37,7 @@ public bool Equals(GitBranch other) { return String.Equals(name, other.name) && - String.Equals(tracking, other.tracking) && - isActive == other.isActive; + String.Equals(tracking, other.tracking); } public static bool operator ==(GitBranch lhs, GitBranch rhs) @@ -65,11 +61,10 @@ public bool Equals(GitBranch other) public string Name => name; public string Tracking => tracking; - public bool IsActive => isActive; public override string ToString() { - return $"{Name} Tracking? {Tracking} Active? {IsActive}"; + return $"{Name} Tracking? {Tracking}"; } } } \ No newline at end of file diff --git a/src/GitHub.Api/Git/Repository.cs b/src/GitHub.Api/Git/Repository.cs index 6e87c0e9a..36de63281 100644 --- a/src/GitHub.Api/Git/Repository.cs +++ b/src/GitHub.Api/Git/Repository.cs @@ -225,11 +225,9 @@ private void RepositoryManagerOnCurrentBranchUpdated(ConfigBranch? branch, Confi name = null; cloneUrl = null; cacheContainer.RepositoryInfoCache.UpdateData(data); - var n = Name; // force refresh of the Name and CloneUrl property - // update active state in local branches - cacheContainer.BranchCache.LocalBranches = LocalConfigBranches; - // update tracking state in remote branches - cacheContainer.BranchCache.RemoteBranches = RemoteConfigBranches; + + // force refresh of the Name and CloneUrl propertys + var n = Name; }); } @@ -262,21 +260,22 @@ private void RepositoryManagerOnGitLocksUpdated(List gitLocks) taskManager.RunInUI(() => cacheContainer.GitLocksCache.GitLocks = gitLocks); } - private void RepositoryManagerOnRemoteBranchesUpdated(Dictionary remotes, - Dictionary> branches) + private void RepositoryManagerOnRemoteBranchesUpdated(Dictionary remoteConfigs, + Dictionary> remoteConfigBranches) { taskManager.RunInUI(() => { - cacheContainer.BranchCache.SetRemotes(remotes, branches); - cacheContainer.BranchCache.Remotes = ConfigRemotes; - cacheContainer.BranchCache.RemoteBranches = RemoteConfigBranches; + var gitRemotes = remoteConfigs.Values.Select(GetGitRemote).ToArray(); + var gitRemoteBranches = remoteConfigBranches.Values.SelectMany(x => x.Values).Select(GetRemoteGitBranch).ToArray(); + + cacheContainer.BranchCache.SetRemotes(remoteConfigs, remoteConfigBranches, gitRemotes, gitRemoteBranches); }); } - private void RepositoryManagerOnLocalBranchesUpdated(Dictionary branches) + private void RepositoryManagerOnLocalBranchesUpdated(Dictionary localConfigBranchDictionary) { taskManager.RunInUI(() => { - cacheContainer.BranchCache.SetLocals(branches); - cacheContainer.BranchCache.LocalBranches = LocalConfigBranches; + var gitLocalBranches = localConfigBranchDictionary.Values.Select(x => GetLocalGitBranch(CurrentBranchName, x)).ToArray(); + cacheContainer.BranchCache.SetLocals(localConfigBranchDictionary, gitLocalBranches); }); } @@ -285,7 +284,7 @@ private static GitBranch GetLocalGitBranch(string currentBranchName, ConfigBranc var branchName = x.Name; var trackingName = x.IsTracking ? x.Remote.Value.Name + "/" + branchName : "[None]"; var isActive = branchName == currentBranchName; - return new GitBranch(branchName, trackingName, isActive); + return new GitBranch(branchName, trackingName); } @@ -307,7 +306,7 @@ public void Dispose() } - private static GitBranch GetRemoteGitBranch(ConfigBranch x) => new GitBranch(x.Remote.Value.Name + "/" + x.Name, "[None]", false); + private static GitBranch GetRemoteGitBranch(ConfigBranch x) => new GitBranch(x.Remote.Value.Name + "/" + x.Name, "[None]"); private static GitRemote GetGitRemote(ConfigRemote configRemote) => new GitRemote(configRemote.Name, configRemote.Url); public GitRemote[] Remotes => cacheContainer.BranchCache.Remotes; @@ -373,10 +372,6 @@ public string Name internal string DebuggerDisplay => String.Format(CultureInfo.InvariantCulture, "{0} Owner: {1} Name: {2} CloneUrl: {3} LocalPath: {4} Branch: {5} Remote: {6}", GetHashCode(), Owner, Name, CloneUrl, LocalPath, CurrentBranch, CurrentRemote); - - private GitBranch[] RemoteConfigBranches => cacheContainer.BranchCache.RemoteConfigBranches.Values.SelectMany(x => x.Values).Select(GetRemoteGitBranch).ToArray(); - private GitRemote[] ConfigRemotes => cacheContainer.BranchCache.ConfigRemotes.Values.Select(GetGitRemote).ToArray(); - private GitBranch[] LocalConfigBranches => cacheContainer.BranchCache.LocalConfigBranches.Values.Select(x => GetLocalGitBranch(CurrentBranchName, x)).ToArray(); } public interface IUser diff --git a/src/GitHub.Api/Git/TreeData.cs b/src/GitHub.Api/Git/TreeData.cs index 1f5141fb3..ac9e67b2c 100644 --- a/src/GitHub.Api/Git/TreeData.cs +++ b/src/GitHub.Api/Git/TreeData.cs @@ -1,4 +1,5 @@ using System; +using System.Security.Cryptography.X509Certificates; namespace GitHub.Unity { @@ -11,19 +12,22 @@ public interface ITreeData [Serializable] public struct GitBranchTreeData : ITreeData { - public static GitBranchTreeData Default = new GitBranchTreeData(Unity.GitBranch.Default); + public static GitBranchTreeData Default = new GitBranchTreeData(Unity.GitBranch.Default, false); public GitBranch GitBranch; + public bool isActive; - public GitBranchTreeData(GitBranch gitBranch) + public GitBranchTreeData(GitBranch gitBranch, bool isActive) { GitBranch = gitBranch; + this.isActive = isActive; } public override int GetHashCode() { int hash = 17; hash = hash * 23 + GitBranch.GetHashCode(); + hash = hash * 23 + isActive.GetHashCode(); return hash; } @@ -36,7 +40,7 @@ public override bool Equals(object other) public bool Equals(GitBranchTreeData other) { - return GitBranch.Equals(other.GitBranch); + return GitBranch.Equals(other.GitBranch) && IsActive == other.IsActive; } public static bool operator ==(GitBranchTreeData lhs, GitBranchTreeData rhs) @@ -59,7 +63,7 @@ public bool Equals(GitBranchTreeData other) } public string Path => GitBranch.Name; - public bool IsActive => GitBranch.IsActive; + public bool IsActive => isActive; } [Serializable] diff --git a/src/GitHub.Api/OutputProcessors/BranchListOutputProcessor.cs b/src/GitHub.Api/OutputProcessors/BranchListOutputProcessor.cs index cca8ed4ed..320ea9435 100644 --- a/src/GitHub.Api/OutputProcessors/BranchListOutputProcessor.cs +++ b/src/GitHub.Api/OutputProcessors/BranchListOutputProcessor.cs @@ -36,7 +36,7 @@ public override void LineReceived(string line) trackingName = proc.ReadChunk('[', ']'); } - var branch = new GitBranch(name, trackingName, active); + var branch = new GitBranch(name, trackingName); RaiseOnEntry(branch); } diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/ApplicationCache.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/ApplicationCache.cs index 794f9ef8b..50b8f51cc 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/ApplicationCache.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/ApplicationCache.cs @@ -480,174 +480,34 @@ sealed class BranchesCache : ManagedCacheBase, IBranchCache public BranchesCache() : base(CacheType.Branches) { } - public GitBranch[] LocalBranches - { - get { return localBranches; } - set - { - var now = DateTimeOffset.Now; - var isUpdated = false; - - Logger.Trace("Updating: {0} localBranches:{1}", now, value); - - var localBranchesIsNull = localBranches == null; - var valueIsNull = value == null; - - if (localBranchesIsNull != valueIsNull || - !localBranchesIsNull && !localBranches.SequenceEqual(value)) - { - localBranches = value; - isUpdated = true; - } - - SaveData(now, isUpdated); - } - } - - public GitBranch[] RemoteBranches - { - get { return remoteBranches; } - set - { - var now = DateTimeOffset.Now; - var isUpdated = false; - - Logger.Trace("Updating: {0} remoteBranches:{1}", now, value); - - var remoteBranchesIsNull = remoteBranches == null; - var valueIsNull = value == null; - - if (remoteBranchesIsNull != valueIsNull || - !remoteBranchesIsNull && !remoteBranches.SequenceEqual(value)) - { - remoteBranches = value; - isUpdated = true; - } - - SaveData(now, isUpdated); - } - } - - public GitRemote[] Remotes - { - get { return remotes; } - set - { - var now = DateTimeOffset.Now; - var isUpdated = false; - - Logger.Trace("Updating: {0} remotes:{1}", now, value); - - var remotesIsNull = remotes == null; - var valueIsNull = value == null; - - if (remotesIsNull != valueIsNull || - !remotesIsNull && !remotes.SequenceEqual(value)) - { - remotes = value; - isUpdated = true; - } - - SaveData(now, isUpdated); - } - } - - public void RemoveLocalBranch(string branch) - { - if (LocalConfigBranches.ContainsKey(branch)) - { - var now = DateTimeOffset.Now; - LocalConfigBranches.Remove(branch); - Logger.Trace("RemoveLocalBranch {0} branch:{1} ", now, branch); - SaveData(now, true); - } - else - { - Logger.Warning("Branch {0} is not found", branch); - } - } - - public void AddLocalBranch(string branch) - { - if (!LocalConfigBranches.ContainsKey(branch)) - { - var now = DateTimeOffset.Now; - LocalConfigBranches.Add(branch, new ConfigBranch(branch)); - Logger.Trace("AddLocalBranch {0} branch:{1} ", now, branch); - SaveData(now, true); - } - else - { - Logger.Warning("Branch {0} is already present", branch); - } - } - - public void AddRemoteBranch(string remote, string branch) - { - Dictionary branchList; - if (RemoteConfigBranches.TryGetValue(remote, out branchList)) - { - if (!branchList.ContainsKey(branch)) - { - var now = DateTimeOffset.Now; - branchList.Add(branch, new ConfigBranch(branch, ConfigRemotes[remote])); - Logger.Trace("AddRemoteBranch {0} remote:{1} branch:{2} ", now, remote, branch); - SaveData(now, true); - } - else - { - Logger.Warning("Branch {0} is already present in Remote {1}", branch, remote); - } - } - else - { - Logger.Warning("Remote {0} is not found", remote); - } - } - - public void RemoveRemoteBranch(string remote, string branch) - { - Dictionary branchList; - if (RemoteConfigBranches.TryGetValue(remote, out branchList)) - { - if (branchList.ContainsKey(branch)) - { - var now = DateTimeOffset.Now; - branchList.Remove(branch); - Logger.Trace("RemoveRemoteBranch {0} remote:{1} branch:{2} ", now, remote, branch); - SaveData(now, true); - } - else - { - Logger.Warning("Branch {0} is not found in Remote {1}", branch, remote); - } - } - else - { - Logger.Warning("Remote {0} is not found", remote); - } - } - - public void SetRemotes(Dictionary remoteDictionary, Dictionary> branchDictionary) + public void SetRemotes(Dictionary remoteConfigs, Dictionary> configBranches, GitRemote[] gitRemotes, GitBranch[] gitBranches) { var now = DateTimeOffset.Now; - configRemotes = new ConfigRemoteDictionary(remoteDictionary); - remoteConfigBranches = new RemoteConfigBranchDictionary(branchDictionary); + configRemotes = new ConfigRemoteDictionary(remoteConfigs); + remoteConfigBranches = new RemoteConfigBranchDictionary(configBranches); + remotes = gitRemotes; + remoteBranches = gitBranches; + Logger.Trace("SetRemotes {0}", now); SaveData(now, true); } - public void SetLocals(Dictionary branchDictionary) + public void SetLocals(Dictionary configBranches, GitBranch[] gitBranches) { var now = DateTimeOffset.Now; - localConfigBranches = new LocalConfigBranchDictionary(branchDictionary); - Logger.Trace("SetRemotes {0}", now); + localConfigBranches = new LocalConfigBranchDictionary(configBranches); + localBranches = gitBranches; + + Logger.Trace("SetLocals {0}", now); SaveData(now, true); } public ILocalConfigBranchDictionary LocalConfigBranches { get { return localConfigBranches; } } public IRemoteConfigBranchDictionary RemoteConfigBranches { get { return remoteConfigBranches; } } public IConfigRemoteDictionary ConfigRemotes { get { return configRemotes; } } + public GitBranch[] LocalBranches { get { return localBranches; } } + public GitBranch[] RemoteBranches { get { return remoteBranches; } } + public GitRemote[] Remotes { get { return remotes; } } public override TimeSpan DataTimeout { get { return TimeSpan.FromDays(1); } } } diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs index 09d347d9e..f0ef7adc8 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs @@ -50,6 +50,12 @@ class BranchesView : Subview [SerializeField] private CacheUpdateEvent lastLocalAndRemoteBranchListChangedEvent; [NonSerialized] private bool localAndRemoteBranchListHasUpdate; + [SerializeField] private CacheUpdateEvent lastCurrentBranchAndRemoteChange; + [NonSerialized] private bool currentBranchAndRemoteChangeHasUpdate; + + [SerializeField] private GitBranch currentBranch = GitBranch.Default; + [SerializeField] private GitRemote currentRemote = GitRemote.Default; + [SerializeField] private List localBranches; [SerializeField] private List remoteBranches; @@ -109,6 +115,17 @@ public override void OnFocusChanged() } } + private void RepositoryOnCurrentBranchAndRemoteChanged(CacheUpdateEvent cacheUpdateEvent) + { + if (!lastCurrentBranchAndRemoteChange.Equals(cacheUpdateEvent)) + { + lastCurrentBranchAndRemoteChange = cacheUpdateEvent; + currentBranchAndRemoteChangeHasUpdate = true; + Redraw(); + } + } + + private void RepositoryOnLocalAndRemoteBranchListChanged(CacheUpdateEvent cacheUpdateEvent) { if (!lastLocalAndRemoteBranchListChangedEvent.Equals(cacheUpdateEvent)) @@ -121,13 +138,25 @@ private void RepositoryOnLocalAndRemoteBranchListChanged(CacheUpdateEvent cacheU private void MaybeUpdateData() { + if (currentBranchAndRemoteChangeHasUpdate) + { + currentBranch = Repository.CurrentBranch ?? GitBranch.Default; + currentRemote = Repository.CurrentRemote ?? GitRemote.Default; + } + if (localAndRemoteBranchListHasUpdate) { - localAndRemoteBranchListHasUpdate = false; localBranches = Repository.LocalBranches.ToList(); remoteBranches = Repository.RemoteBranches.ToList(); + } + + if (currentBranchAndRemoteChangeHasUpdate || localAndRemoteBranchListHasUpdate) + { + currentBranchAndRemoteChangeHasUpdate = false; + localAndRemoteBranchListHasUpdate = false; + BuildTree(); } @@ -143,16 +172,19 @@ public override void OnGUI() private void AttachHandlers(IRepository repository) { repository.LocalAndRemoteBranchListChanged += RepositoryOnLocalAndRemoteBranchListChanged; + repository.CurrentBranchAndRemoteChanged += RepositoryOnCurrentBranchAndRemoteChanged; } private void DetachHandlers(IRepository repository) { repository.LocalAndRemoteBranchListChanged -= RepositoryOnLocalAndRemoteBranchListChanged; + repository.CurrentBranchAndRemoteChanged -= RepositoryOnCurrentBranchAndRemoteChanged; } private void ValidateCachedData(IRepository repository) { repository.CheckAndRaiseEventsIfCacheNewer(CacheType.Branches, lastLocalAndRemoteBranchListChangedEvent); + repository.CheckAndRaiseEventsIfCacheNewer(CacheType.RepositoryInfo, lastCurrentBranchAndRemoteChange); } private void Render() @@ -187,8 +219,8 @@ private void BuildTree() localBranches.Sort(CompareBranches); remoteBranches.Sort(CompareBranches); - treeLocals.Load(localBranches.Select(branch => new GitBranchTreeData(branch))); - treeRemotes.Load(remoteBranches.Select(branch => new GitBranchTreeData(branch))); + treeLocals.Load(localBranches.Select(branch => new GitBranchTreeData(branch, currentBranch != GitBranch.Default && currentBranch.Name == branch.Name))); + treeRemotes.Load(remoteBranches.Select(branch => new GitBranchTreeData(branch, false))); Redraw(); } diff --git a/src/tests/IntegrationTests/CachingClasses.cs b/src/tests/IntegrationTests/CachingClasses.cs index 685a21cd9..b8e15b536 100644 --- a/src/tests/IntegrationTests/CachingClasses.cs +++ b/src/tests/IntegrationTests/CachingClasses.cs @@ -449,172 +449,29 @@ sealed class BranchesCache : ManagedCacheBase, IBranchCache public BranchesCache() : base(CacheType.Branches) { } - - public GitBranch[] LocalBranches - { - get { return localBranches; } - set - { - var now = DateTimeOffset.Now; - var isUpdated = false; - - Logger.Trace("Updating: {0} localBranches:{1}", now, value); - - var localBranchesIsNull = localBranches == null; - var valueIsNull = value == null; - - if (localBranchesIsNull != valueIsNull || - !localBranchesIsNull && !localBranches.SequenceEqual(value)) - { - localBranches = value; - isUpdated = true; - } - - SaveData(now, isUpdated); - } - } - - public GitBranch[] RemoteBranches - { - get { return remoteBranches; } - set - { - var now = DateTimeOffset.Now; - var isUpdated = false; - - Logger.Trace("Updating: {0} remoteBranches:{1}", now, value); - - var remoteBranchesIsNull = remoteBranches == null; - var valueIsNull = value == null; - - if (remoteBranchesIsNull != valueIsNull || - !remoteBranchesIsNull && !remoteBranches.SequenceEqual(value)) - { - remoteBranches = value; - isUpdated = true; - } - - SaveData(now, isUpdated); - } - } - - public GitRemote[] Remotes - { - get { return remotes; } - set - { - var now = DateTimeOffset.Now; - var isUpdated = false; - - Logger.Trace("Updating: {0} remotes:{1}", now, value); - - var remotesIsNull = remotes == null; - var valueIsNull = value == null; - - if (remotesIsNull != valueIsNull || - !remotesIsNull && !remotes.SequenceEqual(value)) - { - remotes = value; - isUpdated = true; - } - - SaveData(now, isUpdated); - } - } - - public void RemoveLocalBranch(string branch) - { - if (LocalConfigBranches.ContainsKey(branch)) - { - var now = DateTimeOffset.Now; - LocalConfigBranches.Remove(branch); - Logger.Trace("RemoveLocalBranch {0} branch:{1} ", now, branch); - SaveData(now, true); - } - else - { - Logger.Warning("Branch {0} is not found", branch); - } - } - - public void AddLocalBranch(string branch) - { - if (!LocalConfigBranches.ContainsKey(branch)) - { - var now = DateTimeOffset.Now; - LocalConfigBranches.Add(branch, new ConfigBranch(branch)); - Logger.Trace("AddLocalBranch {0} branch:{1} ", now, branch); - SaveData(now, true); - } - else - { - Logger.Warning("Branch {0} is already present", branch); - } - } - - public void AddRemoteBranch(string remote, string branch) - { - Dictionary branchList; - if (RemoteConfigBranches.TryGetValue(remote, out branchList)) - { - if (!branchList.ContainsKey(branch)) - { - var now = DateTimeOffset.Now; - branchList.Add(branch, new ConfigBranch(branch, ConfigRemotes[remote])); - Logger.Trace("AddRemoteBranch {0} remote:{1} branch:{2} ", now, remote, branch); - SaveData(now, true); - } - else - { - Logger.Warning("Branch {0} is already present in Remote {1}", branch, remote); - } - } - else - { - Logger.Warning("Remote {0} is not found", remote); - } - } - - public void RemoveRemoteBranch(string remote, string branch) - { - Dictionary branchList; - if (RemoteConfigBranches.TryGetValue(remote, out branchList)) - { - if (branchList.ContainsKey(branch)) - { - var now = DateTimeOffset.Now; - branchList.Remove(branch); - Logger.Trace("RemoveRemoteBranch {0} remote:{1} branch:{2} ", now, remote, branch); - SaveData(now, true); - } - else - { - Logger.Warning("Branch {0} is not found in Remote {1}", branch, remote); - } - } - else - { - Logger.Warning("Remote {0} is not found", remote); - } - } - - public void SetRemotes(Dictionary remoteDictionary, Dictionary> branchDictionary) + public void SetRemotes(Dictionary remoteConfigs, Dictionary> configBranches, GitRemote[] gitRemotes, GitBranch[] gitBranches) { var now = DateTimeOffset.Now; - configRemotes = new ConfigRemoteDictionary(remoteDictionary); - remoteConfigBranches = new RemoteConfigBranchDictionary(branchDictionary); + configRemotes = new ConfigRemoteDictionary(remoteConfigs); + remoteConfigBranches = new RemoteConfigBranchDictionary(remoteConfigBranches); + remotes = gitRemotes; + remoteBranches = gitBranches; Logger.Trace("SetRemotes {0}", now); SaveData(now, true); } - public void SetLocals(Dictionary branchDictionary) + public void SetLocals(Dictionary configBranches, GitBranch[] gitBranches) { var now = DateTimeOffset.Now; - localConfigBranches = new LocalConfigBranchDictionary(branchDictionary); - Logger.Trace("SetRemotes {0}", now); + localConfigBranches = new LocalConfigBranchDictionary(configBranches); + localBranches = gitBranches; + Logger.Trace("SetLocals {0}", now); SaveData(now, true); } + public GitBranch[] LocalBranches { get { return localBranches; } } + public GitBranch[] RemoteBranches { get { return remoteBranches; } } + public GitRemote[] Remotes { get { return remotes; } } public ILocalConfigBranchDictionary LocalConfigBranches { get { return localConfigBranches; } } public IRemoteConfigBranchDictionary RemoteConfigBranches { get { return remoteConfigBranches; } } public IConfigRemoteDictionary ConfigRemotes { get { return configRemotes; } } diff --git a/src/tests/IntegrationTests/Process/ProcessManagerIntegrationTests.cs b/src/tests/IntegrationTests/Process/ProcessManagerIntegrationTests.cs index f843fe7be..bdd418605 100644 --- a/src/tests/IntegrationTests/Process/ProcessManagerIntegrationTests.cs +++ b/src/tests/IntegrationTests/Process/ProcessManagerIntegrationTests.cs @@ -23,8 +23,8 @@ public async Task BranchListTest() .StartAsAsync(); gitBranches.Should().BeEquivalentTo( - new GitBranch("master", "origin/master: behind 1", true), - new GitBranch("feature/document", "origin/feature/document", false)); + new GitBranch("master", "origin/master: behind 1"), + new GitBranch("feature/document", "origin/feature/document")); } [Test] diff --git a/src/tests/UnitTests/IO/BranchListOutputProcessorTests.cs b/src/tests/UnitTests/IO/BranchListOutputProcessorTests.cs index 64d265bdf..f22cc237a 100644 --- a/src/tests/UnitTests/IO/BranchListOutputProcessorTests.cs +++ b/src/tests/UnitTests/IO/BranchListOutputProcessorTests.cs @@ -20,9 +20,9 @@ public void ShouldProcessOutput() AssertProcessOutput(output, new[] { - new GitBranch("master", "origin/master", true), - new GitBranch("feature/feature-1", "", false), - new GitBranch("bugfixes/bugfix-1", "origin/bugfixes/bugfix-1", false), + new GitBranch("master", "origin/master"), + new GitBranch("feature/feature-1", ""), + new GitBranch("bugfixes/bugfix-1", "origin/bugfixes/bugfix-1"), }); }