Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit d99a9a2

Browse files
Merge branch 'master' into enhancements/git-client-cache
2 parents 293f150 + ca56968 commit d99a9a2

File tree

7 files changed

+22
-142
lines changed

7 files changed

+22
-142
lines changed

src/GitHub.Api/Cache/CacheInterfaces.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public interface ILocalConfigBranchDictionary : IDictionary<string, ConfigBranch
6363

6464
}
6565

66-
public interface IRemoteConfigBranchDictionary : IDictionary<string, IDictionary<string, ConfigBranch>>
66+
public interface IRemoteConfigBranchDictionary : IDictionary<string, Dictionary<string, ConfigBranch>>
6767
{
6868

6969
}

src/GitHub.Api/Git/Repository.cs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ private void RepositoryManager_OnCurrentBranchAndRemoteUpdated(ConfigBranch? bra
429429
{
430430
CurrentConfigRemote = remote;
431431
CurrentRemote = GetGitRemote(remote.Value);
432-
UpdateRepositoryInfo();
432+
ClearRepositoryInfo();
433433
}
434434
}) { Affinity = TaskAffinity.UI }.Start();
435435
}
@@ -472,20 +472,10 @@ private void UpdateLocalBranches()
472472
LocalBranches = LocalConfigBranches.Values.Select(GetLocalGitBranch).ToArray();
473473
}
474474

475-
private void UpdateRepositoryInfo()
475+
private void ClearRepositoryInfo()
476476
{
477-
if (CurrentRemote.HasValue)
478-
{
479-
CloneUrl = new UriString(CurrentRemote.Value.Url);
480-
Name = CloneUrl.RepositoryName;
481-
Logger.Trace("CloneUrl: {0}", CloneUrl.ToString());
482-
}
483-
else
484-
{
485-
CloneUrl = null;
486-
Name = LocalPath.FileName;
487-
Logger.Trace("CloneUrl: [NULL]");
488-
}
477+
CloneUrl = null;
478+
Name = null;
489479
}
490480

491481
private void RepositoryManager_OnLocalBranchRemoved(string name)

src/UnityExtension/Assets/Editor/GitHub.Unity/ApplicationCache.cs

Lines changed: 2 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -378,106 +378,6 @@ public void OnAfterDeserialize()
378378
Add(remote, branchesDictionary);
379379
}
380380
}
381-
382-
IEnumerator<KeyValuePair<string, IDictionary<string, ConfigBranch>>> IEnumerable<KeyValuePair<string, IDictionary<string, ConfigBranch>>>.GetEnumerator()
383-
{
384-
throw new NotImplementedException();
385-
//return AsDictionary
386-
// .Select(pair => new KeyValuePair<string, IDictionary<string, ConfigBranch>>(pair.Key, pair.Value.AsDictionary))
387-
// .GetEnumerator();
388-
}
389-
390-
void ICollection<KeyValuePair<string, IDictionary<string, ConfigBranch>>>.Add(KeyValuePair<string, IDictionary<string, ConfigBranch>> item)
391-
{
392-
throw new NotImplementedException();
393-
//Guard.ArgumentNotNull(item, "item");
394-
//Guard.ArgumentNotNull(item.Value, "item.Value");
395-
//
396-
//var serializableDictionary = item.Value as SerializableDictionary<string, ConfigBranch>;
397-
//if (serializableDictionary == null)
398-
//{
399-
// serializableDictionary = new SerializableDictionary<string, ConfigBranch>(item.Value);
400-
//}
401-
//
402-
//Add(item.Key, serializableDictionary);
403-
}
404-
405-
bool ICollection<KeyValuePair<string, IDictionary<string, ConfigBranch>>>.Contains(KeyValuePair<string, IDictionary<string, ConfigBranch>> item)
406-
{
407-
throw new NotImplementedException();
408-
}
409-
410-
void ICollection<KeyValuePair<string, IDictionary<string, ConfigBranch>>>.CopyTo(KeyValuePair<string, IDictionary<string, ConfigBranch>>[] array, int arrayIndex)
411-
{
412-
throw new NotImplementedException();
413-
}
414-
415-
bool ICollection<KeyValuePair<string, IDictionary<string, ConfigBranch>>>.Remove(KeyValuePair<string, IDictionary<string, ConfigBranch>> item)
416-
{
417-
throw new NotImplementedException();
418-
}
419-
420-
bool ICollection<KeyValuePair<string, IDictionary<string, ConfigBranch>>>.IsReadOnly
421-
{
422-
get { throw new NotImplementedException(); }
423-
}
424-
425-
void IDictionary<string, IDictionary<string, ConfigBranch>>.Add(string key, IDictionary<string, ConfigBranch> value)
426-
{
427-
throw new NotImplementedException();
428-
}
429-
430-
bool IDictionary<string, IDictionary<string, ConfigBranch>>.TryGetValue(string key, out IDictionary<string, ConfigBranch> value)
431-
{
432-
value = null;
433-
434-
Dictionary<string, ConfigBranch> branches;
435-
if (TryGetValue(key, out branches))
436-
{
437-
value = branches;
438-
return true;
439-
}
440-
441-
return false;
442-
}
443-
444-
IDictionary<string, ConfigBranch> IDictionary<string, IDictionary<string, ConfigBranch>>.this[string key]
445-
{
446-
get
447-
{
448-
throw new NotImplementedException();
449-
//var dictionary = (IDictionary<string, IDictionary<string, ConfigBranch>>)this;
450-
//IDictionary<string, ConfigBranch> value;
451-
//if (!dictionary.TryGetValue(key, out value))
452-
//{
453-
// throw new KeyNotFoundException();
454-
//}
455-
//
456-
//return value;
457-
}
458-
set
459-
{
460-
throw new NotImplementedException();
461-
//var dictionary = (IDictionary<string, IDictionary<string, ConfigBranch>>)this;
462-
//dictionary.Add(key, value);
463-
}
464-
}
465-
466-
ICollection<string> IDictionary<string, IDictionary<string, ConfigBranch>>.Keys
467-
{
468-
get
469-
{
470-
throw new NotImplementedException();
471-
}
472-
}
473-
474-
ICollection<IDictionary<string, ConfigBranch>> IDictionary<string, IDictionary<string, ConfigBranch>>.Values
475-
{
476-
get
477-
{
478-
return Values.Cast<IDictionary<string,ConfigBranch>>().ToArray();
479-
}
480-
}
481381
}
482382

483383
[Serializable]
@@ -770,7 +670,7 @@ public void AddLocalBranch(string branch)
770670

771671
public void AddRemoteBranch(string remote, string branch)
772672
{
773-
IDictionary<string, ConfigBranch> branchList;
673+
Dictionary<string, ConfigBranch> branchList;
774674
if (RemoteConfigBranches.TryGetValue(remote, out branchList))
775675
{
776676
if (!branchList.ContainsKey(branch))
@@ -793,7 +693,7 @@ public void AddRemoteBranch(string remote, string branch)
793693

794694
public void RemoveRemoteBranch(string remote, string branch)
795695
{
796-
IDictionary<string, ConfigBranch> branchList;
696+
Dictionary<string, ConfigBranch> branchList;
797697
if (RemoteConfigBranches.TryGetValue(remote, out branchList))
798698
{
799699
if (branchList.ContainsKey(branch))

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,9 @@ private void RepositoryOnLocalAndRemoteBranchListChanged(CacheUpdateEvent cacheU
8888
{
8989
if (!lastLocalAndRemoteBranchListChangedEvent.Equals(cacheUpdateEvent))
9090
{
91-
new ActionTask(TaskManager.Token, () =>
92-
{
93-
lastLocalAndRemoteBranchListChangedEvent = cacheUpdateEvent;
94-
localAndRemoteBranchListHasUpdate = true;
95-
Redraw();
96-
})
97-
{ Affinity = TaskAffinity.UI }.Start();
91+
lastLocalAndRemoteBranchListChangedEvent = cacheUpdateEvent;
92+
localAndRemoteBranchListHasUpdate = true;
93+
Redraw();
9894
}
9995
}
10096

@@ -114,16 +110,11 @@ private void MaybeUpdateData()
114110

115111
private void AttachHandlers(IRepository repository)
116112
{
117-
if (repository == null)
118-
return;
119-
120113
repository.LocalAndRemoteBranchListChanged += RepositoryOnLocalAndRemoteBranchListChanged;
121114
}
122115

123116
private void DetachHandlers(IRepository repository)
124117
{
125-
if (repository == null)
126-
return;
127118

128119
repository.LocalAndRemoteBranchListChanged -= RepositoryOnLocalAndRemoteBranchListChanged;
129120
}

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/PopupWindow.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ public override void OnDisable()
7070
public override void OnDataUpdate()
7171
{
7272
base.OnDataUpdate();
73+
if (titleContent.image == null)
74+
titleContent = new GUIContent(ActiveView.Title, Styles.SmallLogo);
7375
ActiveView.OnDataUpdate();
7476
}
7577

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/SettingsView.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,8 @@ public override void OnEnable()
5151
userSettingsView.OnEnable();
5252
AttachHandlers(Repository);
5353

54-
if (Repository != null)
55-
{
56-
Repository.CheckCurrentRemoteChangedEvent(lastCurrentRemoteChangedEvent);
57-
Repository.CheckLocksChangedEvent(lastLocksChangedEvent);
58-
}
59-
54+
Repository.CheckCurrentRemoteChangedEvent(lastCurrentRemoteChangedEvent);
55+
Repository.CheckLocksChangedEvent(lastLocksChangedEvent);
6056
metricsHasChanged = true;
6157
}
6258

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/Window.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ public override void OnDisable()
112112
public override void OnDataUpdate()
113113
{
114114
base.OnDataUpdate();
115-
115+
if (titleContent.image == null)
116+
titleContent = new GUIContent(Title, Styles.SmallLogo);
116117
MaybeUpdateData();
117118

118119
if (ActiveView != null)
@@ -129,9 +130,8 @@ public override void OnRepositoryChanged(IRepository oldRepository)
129130
if (Repository != null && activeTab == SubTab.InitProject)
130131
{
131132
changeTab = SubTab.History;
133+
UpdateActiveTab();
132134
}
133-
134-
UpdateActiveTab();
135135
}
136136

137137
public override void OnSelectionChange()
@@ -317,7 +317,6 @@ private void DoToolbarGUI()
317317
// Subtabs & toolbar
318318
GUILayout.BeginHorizontal(EditorStyles.toolbar);
319319
{
320-
changeTab = activeTab;
321320
EditorGUI.BeginChangeCheck();
322321
{
323322
if (HasRepository)
@@ -352,7 +351,8 @@ private void UpdateActiveTab()
352351
{
353352
var fromView = ActiveView;
354353
activeTab = changeTab;
355-
SwitchView(fromView, ActiveView);
354+
var toView = ActiveView;
355+
SwitchView(fromView, toView);
356356
}
357357
}
358358

@@ -363,6 +363,7 @@ private void SwitchView(Subview fromView, Subview toView)
363363
if (fromView != null)
364364
fromView.OnDisable();
365365
toView.OnEnable();
366+
toView.OnDataUpdate();
366367

367368
// this triggers a repaint
368369
Repaint();
@@ -424,9 +425,9 @@ public void ShowNotification(GUIContent content, float timeout)
424425
base.ShowNotification(content);
425426
}
426427

427-
private static SubTab TabButton(SubTab tab, string title, SubTab activeTab)
428+
private static SubTab TabButton(SubTab tab, string title, SubTab currentTab)
428429
{
429-
return GUILayout.Toggle(activeTab == tab, title, EditorStyles.toolbarButton) ? tab : activeTab;
430+
return GUILayout.Toggle(currentTab == tab, title, EditorStyles.toolbarButton) ? tab : currentTab;
430431
}
431432

432433
private Subview ToView(SubTab tab)

0 commit comments

Comments
 (0)