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
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
37 changes: 26 additions & 11 deletions src/UnityExtension/Assets/Editor/GitHub.Unity/ApplicationCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ public bool FirstRun
return val;
}
}

[SerializeField] private string createdDate;
public string CreatedDate
{
get { return createdDate; }
}
}

sealed class EnvironmentCache : ScriptObjectSingleton<EnvironmentCache>
Expand Down Expand Up @@ -83,15 +77,14 @@ public void Flush()
}
}

[Location("cache/branches.yaml", LocationAttribute.Location.UserFolder)]
[Location("cache/branches.yaml", LocationAttribute.Location.LibraryFolder)]
sealed class BranchCache : ScriptObjectSingleton<BranchCache>, IBranchCache
{
[SerializeField] private List<GitBranch> localBranches;
[SerializeField] private List<GitBranch> remoteBranches;
[SerializeField] private List<GitBranch> test;

public BranchCache()
{
test = new List<GitBranch>() { new GitBranch("name", "tracking", false) };
}

public List<GitBranch> LocalBranches
Expand All @@ -104,7 +97,6 @@ public List<GitBranch> LocalBranches
}
set
{
Logging.GetLogger().Debug("Saving branches {0}", value.Join(","));
localBranches = value;
Save(true);
}
Expand All @@ -125,7 +117,7 @@ public List<GitBranch> RemoteBranches
}
}

[Location("views/branches.yaml", LocationAttribute.Location.UserFolder)]
[Location("views/branches.yaml", LocationAttribute.Location.LibraryFolder)]
sealed class Favourites : ScriptObjectSingleton<Favourites>
{
[SerializeField] private List<string> favouriteBranches;
Expand Down Expand Up @@ -174,4 +166,27 @@ public bool IsFavourite(string branchName)
return FavouriteBranches.Contains(branchName);
}
}

[Location("cache/gitlog.yaml", LocationAttribute.Location.LibraryFolder)]
sealed class GitLogCache : ScriptObjectSingleton<GitLogCache>
{
[SerializeField] private List<GitLogEntry> log;
public GitLogCache()
{}

public List<GitLogEntry> Log
{
get
{
if (log == null)
log = new List<GitLogEntry>();
return log;
}
set
{
log = value;
Save(true);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace GitHub.Unity
[AttributeUsage(AttributeTargets.Class)]
class LocationAttribute : Attribute
{
public enum Location { PreferencesFolder, ProjectFolder, UserFolder }
public enum Location { PreferencesFolder, ProjectFolder, LibraryFolder, UserFolder }
public string filepath { get; set; }
public LocationAttribute(string relativePath, Location location)
{
Expand All @@ -21,8 +21,8 @@ public LocationAttribute(string relativePath, Location location)
filepath = InternalEditorUtility.unityPreferencesFolder + "/" + relativePath;
else if (location == Location.UserFolder)
filepath = EntryPoint.Environment.UserCachePath.Combine(relativePath).ToString(SlashMode.Forward);
else
filepath = relativePath;
else if (location == Location.LibraryFolder)
filepath = EntryPoint.Environment.UnityProjectPath.Combine("Library", "gfu", relativePath);
}
}

Expand Down