Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
fd1165f
A cache manager
shana Sep 19, 2017
896dae9
Merge branch 'master' into features/cache-manager
StanleyGoldman Oct 20, 2017
f55b9d8
Updating branch cache on branch change
StanleyGoldman Oct 20, 2017
289038d
Initializing BranchCache
StanleyGoldman Oct 20, 2017
91f919d
Migrating GitLogCache to CacheManager
StanleyGoldman Oct 20, 2017
f0083d9
Adding some logging for sanity
StanleyGoldman Oct 20, 2017
f8c951e
Unintentional class move
StanleyGoldman Oct 20, 2017
fcf8667
Undoing more unintentional change
StanleyGoldman Oct 20, 2017
0fd147a
Adding cache managers and making use of the RepositoryInfoCacheManage…
StanleyGoldman Oct 25, 2017
55038c9
Increasing timeout
StanleyGoldman Oct 25, 2017
b3fafd8
Firing events on the main thread
StanleyGoldman Oct 25, 2017
360851a
Figuring out a base class sytem that works for these cache objects
StanleyGoldman Oct 25, 2017
748c126
Using this new base class
StanleyGoldman Oct 26, 2017
f00b333
Removing more test cache code
StanleyGoldman Oct 26, 2017
952a142
Removing last instance of that test cache object
StanleyGoldman Oct 26, 2017
7f4428e
Setting default value on lastUpdated and lastVerified values
StanleyGoldman Oct 26, 2017
ffd2f1b
Renaming some variables
StanleyGoldman Oct 26, 2017
89936f7
Merge branch 'fixes/application-cache-double-call' into features/cach…
StanleyGoldman Oct 26, 2017
76aa8a9
Merge branch 'master' into features/cache-manager
StanleyGoldman Oct 26, 2017
144da6c
Moving where CacheContainer is created and how it gets into Repository
StanleyGoldman Oct 26, 2017
9eea8a6
Changing how the cache items are created
StanleyGoldman Oct 26, 2017
181ca0a
Missing save in base class
StanleyGoldman Oct 26, 2017
41b105f
Renaming file
StanleyGoldman Oct 26, 2017
1b7862b
Changing the struct GitBranch to use a default constructor and fields
StanleyGoldman Oct 27, 2017
e2d1c7f
Merge branch 'fixes/oh-my-struct-constructor' into features/cache-man…
StanleyGoldman Oct 27, 2017
14a1a83
Using default values for structs correctly
StanleyGoldman Oct 27, 2017
86530ac
Removing reset during invalidation
StanleyGoldman Oct 27, 2017
5e1879a
Kneecapping data timeout
StanleyGoldman Oct 27, 2017
f6da8bd
Merge branch 'features/cache-manager' into features/using-cache-manager
StanleyGoldman Oct 27, 2017
08c566d
Disabling RepositoryManagerTests
StanleyGoldman Oct 27, 2017
a20de1e
Disabling RepositoryTests as well
StanleyGoldman Oct 27, 2017
dc7b426
Merge branch 'features/cache-manager' into features/using-cache-manager
StanleyGoldman Oct 27, 2017
6a832a9
Merge branch 'fixes/window-maybe-update-data' into features/using-cac…
StanleyGoldman Oct 27, 2017
4407481
Starting to add an event to represent cache changes from the Repository
StanleyGoldman Oct 27, 2017
fc97337
Merge branch 'fixes/window-maybe-update-data' into features/using-cac…
StanleyGoldman Oct 27, 2017
7e78331
Merge branch 'fixes/window-maybe-update-data' into features/using-cac…
StanleyGoldman Oct 27, 2017
1b9b470
Integrating the few Window displays with the cache notification system
StanleyGoldman Oct 27, 2017
e558ee9
Merge branch 'fixes/git-status-output-processor' into features/using-…
StanleyGoldman Oct 27, 2017
51d37b3
Removing log from CacheContainer constructor
StanleyGoldman Oct 27, 2017
9a9a72e
Merge branch 'features/cache-manager' into features/using-cache-manager
StanleyGoldman Oct 27, 2017
fcb9481
Removing unused logger
StanleyGoldman Oct 27, 2017
8468d9b
Merge branch 'features/cache-manager' into features/using-cache-manager
StanleyGoldman Oct 27, 2017
948fd8a
Merge branch 'fixes/window-child-view-attach' into features/using-cac…
StanleyGoldman Oct 27, 2017
1569534
Merge branch 'fixes/window-child-view-attach' into features/using-cac…
StanleyGoldman Oct 27, 2017
f57da7a
Populating GitStatus through cache
StanleyGoldman Oct 27, 2017
5674b9c
Merge branch 'fixes/what-pragma-warning' into features/using-cache-ma…
StanleyGoldman Oct 30, 2017
2b4dff4
Figuring out a naming convention
StanleyGoldman Oct 30, 2017
946ef39
A few renames and converting HistoryView
StanleyGoldman Oct 30, 2017
51f98ba
Merge branch 'fixes/isolating-favorites' into features/using-cache-ma…
StanleyGoldman Oct 30, 2017
eeb44d1
Removing redundant interfaces
StanleyGoldman Oct 30, 2017
94132f0
Merge branch 'fixes/repository-remove-remote-branch' into features/us…
StanleyGoldman Oct 30, 2017
94e2ab2
Merge branch 'master' into features/using-cache-manager
StanleyGoldman Oct 30, 2017
735dfd9
Removing chain of Refresh that does nothing
StanleyGoldman Oct 30, 2017
4c9ff07
Merge branch 'fixes/isolating-favorites' into features/using-cache-ma…
StanleyGoldman Oct 31, 2017
0165c71
Merge branch 'master' into features/using-cache-manager
StanleyGoldman Oct 31, 2017
fb92b54
Adding SerializableDictionary
StanleyGoldman Oct 31, 2017
31e7af6
Getting branches to work with the cache
StanleyGoldman Oct 31, 2017
5c645cb
Functionality to manage locks
StanleyGoldman Oct 31, 2017
675d364
ChangesView isBusy should default to false
StanleyGoldman Oct 31, 2017
7545af6
Updating git log and status after the current branch is updated
StanleyGoldman Oct 31, 2017
cdae882
Background updates of different caches
StanleyGoldman Oct 31, 2017
d43102d
Updating locks and remotes in SettingsView
StanleyGoldman Oct 31, 2017
034ba9c
Fixing exception message
StanleyGoldman Nov 1, 2017
af3bf88
Making GitLock serializable
StanleyGoldman Nov 1, 2017
84b7e17
Merge branch 'fixes/git-locks-serializable' into features/using-cache…
StanleyGoldman Nov 1, 2017
77dc497
I thought this would work
StanleyGoldman Nov 1, 2017
9898fd9
Proof the values are being set, just not serializing
StanleyGoldman Nov 1, 2017
854b189
A culprit has been discovered
StanleyGoldman Nov 1, 2017
eb4c2d0
Correctly serializing remote branch dictionaries
StanleyGoldman Nov 1, 2017
f81d00f
Restoring RepositoryInfoCache
StanleyGoldman Nov 1, 2017
f726c7f
No need to use the UriString when the string is available
StanleyGoldman Nov 1, 2017
52491d6
Populating repository name and clone uri from cache
StanleyGoldman Nov 1, 2017
dfb571a
Removing RepositoryTests
StanleyGoldman Nov 1, 2017
95613fe
Fixing update bug
StanleyGoldman Nov 1, 2017
52f315c
Adding an optimization to usages of cache manager
StanleyGoldman Nov 1, 2017
d5f6d87
Fixing field usage
StanleyGoldman Nov 1, 2017
1d15704
Removing unused field
StanleyGoldman Nov 1, 2017
cc41b22
The relevant data is updated in RepositoryInfoCache not BranchCache
StanleyGoldman Nov 1, 2017
07ae865
Merge fixes/oh-my-struct-constructor into features/using-cache-manager
shana Nov 2, 2017
b7ed8f8
Merge fixes/git-locks-serializable into features/using-cache-manager
shana Nov 2, 2017
fa99642
Merge master into features/using-cache-manager
shana Nov 2, 2017
4d03791
Fix merge
shana Nov 2, 2017
90535f2
Move CacheContainer into environment and use a mock for the tests
shana Nov 2, 2017
18c19df
Adding events to repository that better represent the values that are…
StanleyGoldman Nov 2, 2017
6af5853
Updating log messages
StanleyGoldman Nov 2, 2017
742a1a3
Isolating cache access to properties
StanleyGoldman Nov 2, 2017
5fbc0fd
Merge branch 'fixes/window-child-view-attach' into features/using-cac…
StanleyGoldman Nov 2, 2017
2a6e2dd
Data hiding
StanleyGoldman Nov 2, 2017
18779df
Following struct with Default pattern in GitRemote
StanleyGoldman Nov 2, 2017
9e7a370
Utilizing struct defaults
StanleyGoldman Nov 2, 2017
30dd822
Fixing errors caused by the changes to GitRemote
StanleyGoldman Nov 2, 2017
e372d13
More fixes around GitRemote
StanleyGoldman Nov 2, 2017
33f6e9f
Fixing unit tests
StanleyGoldman Nov 2, 2017
01736cb
Fixing unit test
StanleyGoldman Nov 2, 2017
73858ea
Merge branch 'features/using-cache-manager' into fixes/repository-wit…
StanleyGoldman Nov 2, 2017
ffe5027
Removing redundant variable
StanleyGoldman Nov 3, 2017
2efa02f
Merge pull request #401 from github-for-unity/fixes/repository-with-b…
shana Nov 6, 2017
c2e14c5
Changing RepositoryManager OnLocalBranchListUpdated and OnRemoteBranc…
StanleyGoldman Nov 6, 2017
1dc8762
Removing main thread wrapper
StanleyGoldman Nov 6, 2017
1b27c29
Making property setters private
StanleyGoldman Nov 6, 2017
48564ff
Moving Repository events to the top of the file
StanleyGoldman Nov 6, 2017
37e78a7
Moving Then and Start calls to separate lines
StanleyGoldman Nov 6, 2017
a3f3658
Corrected method name spelling
StanleyGoldman Nov 6, 2017
efc90b6
Moving private methods after public methods
StanleyGoldman Nov 6, 2017
c29492c
Fixing spacing issue
StanleyGoldman Nov 6, 2017
bae6029
Moving the property value check to the main thread
StanleyGoldman Nov 6, 2017
f28a24b
Removing unneccessary flag
StanleyGoldman Nov 6, 2017
58a1e09
Merge branch 'master' into features/using-cache-manager
StanleyGoldman Nov 6, 2017
aff4698
Moving method
StanleyGoldman Nov 6, 2017
d64f2cd
Grouping fields
StanleyGoldman Nov 6, 2017
04b03fc
Moving methods
StanleyGoldman Nov 6, 2017
3eb968c
Some code formatting
StanleyGoldman Nov 6, 2017
0938eda
Organizing HistoryView
StanleyGoldman Nov 6, 2017
dbbc878
Organizing SettingsView
StanleyGoldman Nov 6, 2017
3ae8c94
Making fields public so they can be serialized
StanleyGoldman Nov 6, 2017
9e39cb4
Removing readonly on GitRemote.token
StanleyGoldman Nov 6, 2017
1528234
Populating name if null
StanleyGoldman Nov 6, 2017
f15a295
Cleanup GitRemote class
shana Nov 7, 2017
08705a7
Format SerializableDictionary according to our coding style
shana Nov 7, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/GitHub.Api/Application/ApplicationManagerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ public void Dispose()
public ISettings SystemSettings { get; protected set; }
public ISettings UserSettings { get; protected set; }
public IUsageTracker UsageTracker { get; protected set; }

protected TaskScheduler UIScheduler { get; private set; }
protected SynchronizationContext SynchronizationContext { get; private set; }
protected IRepositoryManager RepositoryManager { get { return repositoryManager; } }
Expand Down
106 changes: 106 additions & 0 deletions src/GitHub.Api/Cache/CacheInterfaces.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
using System;
using System.Collections.Generic;

namespace GitHub.Unity
{
public enum CacheType
{
RepositoryInfoCache,
BranchCache,
GitLogCache,
GitStatusCache,
GitLocksCache,
GitUserCache
}

public interface ICacheContainer
{
event Action<CacheType> CacheInvalidated;
event Action<CacheType, DateTimeOffset> CacheUpdated;

IBranchCache BranchCache { get; }
IGitLogCache GitLogCache { get; }
IGitStatusCache GitStatusCache { get; }
IGitLocksCache GitLocksCache { get; }
IGitUserCache GitUserCache { get; }
IRepositoryInfoCache RepositoryInfoCache { get; }
void Validate(CacheType cacheType);
void ValidateAll();
void Invalidate(CacheType cacheType);
void InvalidateAll();
}

public interface IManagedCache
{
event Action CacheInvalidated;
event Action<DateTimeOffset> CacheUpdated;

void ValidateData();
void InvalidateData();

DateTimeOffset LastUpdatedAt { get; }
DateTimeOffset LastVerifiedAt { get; }
}

public interface IGitLocksCache : IManagedCache
{
List<GitLock> GitLocks { get; set; }
}

public interface IGitUserCache : IManagedCache
{
User User { get; }
}

public interface IGitStatusCache : IManagedCache
{
GitStatus GitStatus { get; set; }
}

public interface ILocalConfigBranchDictionary : IDictionary<string, ConfigBranch>
{

}

public interface IRemoteConfigBranchDictionary : IDictionary<string, IDictionary<string, ConfigBranch>>
{

}

public interface IConfigRemoteDictionary : IDictionary<string, ConfigRemote>
{

}

public interface IBranchCache : IManagedCache
{
ConfigRemote? CurrentConfigRemote { get; set; }
ConfigBranch? CurentConfigBranch { get; set; }

GitBranch[] LocalBranches { get; set; }
GitBranch[] RemoteBranches { get; set; }
GitRemote[] Remotes { get; set; }

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<string, ConfigRemote> remoteDictionary, Dictionary<string, Dictionary<string, ConfigBranch>> branchDictionary);
void SetLocals(Dictionary<string, ConfigBranch> branchDictionary);
}

public interface IRepositoryInfoCache : IManagedCache
{
GitRemote? CurrentGitRemote { get; set; }
GitBranch? CurentGitBranch { get; set; }
}

public interface IGitLogCache : IManagedCache
{
List<GitLogEntry> Log { get; set; }
}
}
10 changes: 0 additions & 10 deletions src/GitHub.Api/Cache/IBranchCache.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/GitHub.Api/Git/GitLogEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public string PrettyTimeString
}
}

[NonSerialized] public DateTimeOffset? timeValue;
[NonSerialized] private DateTimeOffset? timeValue;
public DateTimeOffset Time
{
get
Expand All @@ -56,7 +56,7 @@ public DateTimeOffset Time
}
}

[NonSerialized] public DateTimeOffset? commitTimeValue;
[NonSerialized] private DateTimeOffset? commitTimeValue;
public DateTimeOffset? CommitTime
{
get
Expand Down
68 changes: 61 additions & 7 deletions src/GitHub.Api/Git/GitRemote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,59 @@ public enum GitRemoteFunction
[Serializable]
public struct GitRemote
{
public string Name;
public string Url;
public string Login;
public string User;
public string Token;
public string Host;
public GitRemoteFunction Function;
public static GitRemote Default = new GitRemote();

public string name;
public string url;
public string login;
public string user;
public string host;
public GitRemoteFunction function;
public string token;

public GitRemote(string name, string host, string url, GitRemoteFunction function, string user, string login, string token)
{
this.name = name;
this.url = url;
this.host = host;
this.function = function;
this.user = user;
this.login = login;
this.token = token;
}

public GitRemote(string name, string host, string url, GitRemoteFunction function, string user)
{
this.name = name;
this.url = url;
this.host = host;
this.function = function;
this.user = user;
this.login = null;
this.token = null;
}

public GitRemote(string name, string host, string url, GitRemoteFunction function)
{
this.name = name;
this.url = url;
this.host = host;
this.function = function;
this.user = null;
this.login = null;
this.token = null;
}

public GitRemote(string name, string url)
{
this.name = name;
this.url = url;
this.login = null;
this.user = null;
this.token = null;
this.host = null;
this.function = GitRemoteFunction.Unknown;
}

public override string ToString()
{
Expand All @@ -33,5 +79,13 @@ public override string ToString()
sb.AppendLine(String.Format("Function: {0}", Function));
return sb.ToString();
}

public string Name => name;
public string Url => url;
public string Login => login;
public string User => user;
public string Token => token;
public string Host => host;
public GitRemoteFunction Function => function;
}
}
39 changes: 24 additions & 15 deletions src/GitHub.Api/Git/IRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,26 @@ namespace GitHub.Unity
public interface IRepository : IEquatable<IRepository>
{
void Initialize(IRepositoryManager repositoryManager);
void Refresh();
ITask CommitAllFiles(string message, string body);
ITask CommitFiles(List<string> files, string message, string body);
ITask SetupRemote(string remoteName, string remoteUrl);
ITask<List<GitLogEntry>> Log();
ITask Pull();
ITask Push();
ITask Fetch();
ITask Revert(string changeset);
ITask ListLocks();
ITask RequestLock(string file);
ITask ReleaseLock(string file, bool force);

void CheckLogChangedEvent(CacheUpdateEvent gitLogCacheUpdateEvent);
void CheckStatusChangedEvent(CacheUpdateEvent cacheUpdateEvent);
void CheckCurrentBranchChangedEvent(CacheUpdateEvent cacheUpdateEvent);
void CheckCurrentRemoteChangedEvent(CacheUpdateEvent cacheUpdateEvent);
void CheckCurrentBranchAndRemoteChangedEvent(CacheUpdateEvent cacheUpdateEvent);
void CheckLocalBranchListChangedEvent(CacheUpdateEvent cacheUpdateEvent);
void CheckLocksChangedEvent(CacheUpdateEvent cacheUpdateEvent);
void CheckRemoteBranchListChangedEvent(CacheUpdateEvent cacheUpdateEvent);
void CheckLocalAndRemoteBranchListChangedEvent(CacheUpdateEvent cacheUpdateEvent);

/// <summary>
/// Gets the name of the repository.
/// </summary>
Expand Down Expand Up @@ -51,20 +58,22 @@ public interface IRepository : IEquatable<IRepository>
/// </summary>
GitBranch? CurrentBranch { get; }
GitStatus CurrentStatus { get; }
IList<GitRemote> Remotes { get; }
IEnumerable<GitBranch> LocalBranches { get; }
IEnumerable<GitBranch> RemoteBranches { get; }
GitRemote[] Remotes { get; }
GitBranch[] LocalBranches { get; }
GitBranch[] RemoteBranches { get; }
IUser User { get; set; }
IList<GitLock> CurrentLocks { get; }
List<GitLock> CurrentLocks { get; }
string CurrentBranchName { get; }
List<GitLogEntry> CurrentLog { get; }

event Action<GitStatus> OnStatusChanged;
event Action<string> OnCurrentBranchChanged;
event Action<string> OnCurrentRemoteChanged;
event Action OnLocalBranchListChanged;
event Action OnCurrentBranchUpdated;
event Action<IEnumerable<GitLock>> OnLocksChanged;
event Action OnRepositoryInfoChanged;
event Action OnRemoteBranchListChanged;
event Action<CacheUpdateEvent> LogChanged;
event Action<CacheUpdateEvent> StatusChanged;
event Action<CacheUpdateEvent> CurrentBranchChanged;
event Action<CacheUpdateEvent> CurrentRemoteChanged;
event Action<CacheUpdateEvent> CurrentBranchAndRemoteChanged;
event Action<CacheUpdateEvent> LocalBranchListChanged;
event Action<CacheUpdateEvent> LocksChanged;
event Action<CacheUpdateEvent> RemoteBranchListChanged;
event Action<CacheUpdateEvent> LocalAndRemoteBranchListChanged;
}
}
Loading