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
36 commits
Select commit Hold shift + click to select a range
4939060
Removing unused success variable in GitConfig
StanleyGoldman Oct 19, 2017
e4de844
Removing unused functionality to disable the native interface in Repo…
StanleyGoldman Oct 19, 2017
7bdd974
Removing unused string builder
StanleyGoldman Oct 19, 2017
de70b7f
Removing UsageTracker from RepositoryManager
StanleyGoldman Oct 19, 2017
e5c3ee8
Removing the cancellationToken from RepositoryManager
StanleyGoldman Oct 19, 2017
0bd09d6
Removing unused task from RepositoryWatcher
StanleyGoldman Oct 19, 2017
5d2582f
Removing unused credential manager from GitClient
StanleyGoldman Oct 19, 2017
29cf4b9
Removing unused fields from ApiClient
StanleyGoldman Oct 19, 2017
f9e7948
Removing unused variables from HistoryView
StanleyGoldman Oct 19, 2017
46ca301
Removing unused fields from SettingsView
StanleyGoldman Oct 19, 2017
4b73234
Removing unused fields from SettingsView
StanleyGoldman Oct 19, 2017
e68735f
Removing unused data from InitProjectView
StanleyGoldman Oct 19, 2017
bc15e77
Removing unused timelineBarColor from Styles
StanleyGoldman Oct 19, 2017
44a843f
Removing unused variable and fixing missing BeginHorizontal in Window
StanleyGoldman Oct 19, 2017
7b003ed
Removing unused field in HistoryView
StanleyGoldman Oct 19, 2017
2cc4920
Removing unused field in ApplicationCache
StanleyGoldman Oct 19, 2017
6ce0802
Merge branch 'master' into fixes/cleanup
StanleyGoldman Oct 19, 2017
bef2444
Fixing build error
StanleyGoldman Oct 19, 2017
b6daa32
Removing unused field from BaseWindow
StanleyGoldman Oct 19, 2017
161ee17
Removing unused Logger
StanleyGoldman Oct 19, 2017
0221b72
Removing unused field from Styles
StanleyGoldman Oct 19, 2017
97a2ddd
Removing several unused fields from TaskSystem.Tests
StanleyGoldman Oct 19, 2017
b87d2c2
Removing enivronment from GitCredentialManager
StanleyGoldman Oct 19, 2017
596522b
Removing unused test
StanleyGoldman Oct 19, 2017
93a3aaa
Removing unused variables
StanleyGoldman Oct 19, 2017
b2829a7
Removing unused local variables
StanleyGoldman Oct 19, 2017
23052dd
Removing unused field from SimpleJson
StanleyGoldman Oct 19, 2017
7af8e7f
Removing more commented out tests
StanleyGoldman Oct 19, 2017
8e24952
Some UnitTest cleanup
StanleyGoldman Oct 19, 2017
84b6459
Removing unused variable
StanleyGoldman Oct 19, 2017
88879b4
Removing unused logger
StanleyGoldman Oct 19, 2017
0c218a9
Minor test cleanup
StanleyGoldman Oct 19, 2017
ac50823
Removing unused variables in ThreadSynchronizationContext classes
StanleyGoldman Oct 19, 2017
adf0d22
Merge branch 'master' into fixes/cleanup
StanleyGoldman Oct 19, 2017
01870e0
Merge branch 'master' into fixes/cleanup
StanleyGoldman Oct 19, 2017
3a22ba4
Merge branch 'master' into fixes/cleanup
shana Oct 20, 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
5 changes: 0 additions & 5 deletions src/GitHub.Api/Application/ApiClient.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Octokit;

Expand All @@ -27,14 +26,10 @@ public static IApiClient Create(UriString repositoryUrl, IKeychain keychain)
private readonly IKeychain keychain;
private readonly IGitHubClient githubClient;
private readonly ILoginManager loginManager;
private static readonly SemaphoreSlim sem = new SemaphoreSlim(1);

IList<Organization> organizationsCache;
Octokit.User userCache;

string owner;
bool? isEnterprise;

public ApiClient(UriString hostUrl, IKeychain keychain, IGitHubClient githubClient)
{
Guard.ArgumentNotNull(hostUrl, nameof(hostUrl));
Expand Down
4 changes: 2 additions & 2 deletions src/GitHub.Api/Application/ApplicationManagerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected void Initialize()
Logging.TracingEnabled = UserSettings.Get(Constants.TraceLoggingKey, false);
ProcessManager = new ProcessManager(Environment, Platform.GitEnvironment, CancellationToken);
Platform.Initialize(ProcessManager, TaskManager);
GitClient = new GitClient(Environment, ProcessManager, Platform.CredentialManager, TaskManager);
GitClient = new GitClient(Environment, ProcessManager, TaskManager);
SetupMetrics();
}

Expand Down Expand Up @@ -127,7 +127,7 @@ public void RestartRepository()
{
if (Environment.RepositoryPath != null)
{
repositoryManager = Unity.RepositoryManager.CreateInstance(Platform, TaskManager, UsageTracker, GitClient, Environment.RepositoryPath);
repositoryManager = Unity.RepositoryManager.CreateInstance(Platform, TaskManager, GitClient, Environment.RepositoryPath);
repositoryManager.Initialize();
Environment.Repository.Initialize(repositoryManager);
repositoryManager.Start();
Expand Down
13 changes: 2 additions & 11 deletions src/GitHub.Api/Events/RepositoryWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ class RepositoryWatcher : IRepositoryWatcher
private readonly CancellationToken cancellationToken;
private readonly NPath[] ignoredPaths;
private readonly ManualResetEventSlim pauseEvent;
private readonly bool disableNative;
private NativeInterface nativeInterface;
private bool running;
private Task task;
private int lastCountOfProcessedEvents = 0;
private bool processingEvents;
private readonly ManualResetEventSlim signalProcessingEventsDone = new ManualResetEventSlim(false);
Expand Down Expand Up @@ -68,8 +66,7 @@ public void Initialize()

try
{
if (!disableNative)
nativeInterface = new NativeInterface(pathsRepositoryPath);
nativeInterface = new NativeInterface(pathsRepositoryPath);
}
catch (Exception ex)
{
Expand All @@ -79,12 +76,6 @@ public void Initialize()

public void Start()
{
if (disableNative)
{
Logger.Trace("Native interface is disabled");
return;
}

if (nativeInterface == null)
{
Logger.Warning("NativeInterface is null");
Expand All @@ -95,7 +86,7 @@ public void Start()

running = true;
pauseEvent.Reset();
task = Task.Factory.StartNew(WatcherLoop, cancellationToken, TaskCreationOptions.None, TaskScheduler.Default);
Task.Factory.StartNew(WatcherLoop, cancellationToken, TaskCreationOptions.None, TaskScheduler.Default);
}

public void Stop()
Expand Down
5 changes: 1 addition & 4 deletions src/GitHub.Api/Git/GitClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,13 @@ class GitClient : IGitClient
{
private readonly IEnvironment environment;
private readonly IProcessManager processManager;
private readonly ICredentialManager credentialManager;
private readonly ITaskManager taskManager;
private readonly CancellationToken cancellationToken;

public GitClient(IEnvironment environment, IProcessManager processManager,
ICredentialManager credentialManager, ITaskManager taskManager)
public GitClient(IEnvironment environment, IProcessManager processManager, ITaskManager taskManager)
{
this.environment = environment;
this.processManager = processManager;
this.credentialManager = credentialManager;
this.taskManager = taskManager;
this.cancellationToken = taskManager.Token;
}
Expand Down
8 changes: 4 additions & 4 deletions src/GitHub.Api/Git/GitConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,16 +216,16 @@ public string GetString(string key)
public int GetInt(string key)
{
var value = this[key];
var result = 0;
var success = int.TryParse(value, out result);
int result = 0;
int.TryParse(value, out result);
return result;
}

public float GetFloat(string key)
{
var value = this[key];
var result = 0F;
var success = float.TryParse(value, out result);
float result = 0F;
float.TryParse(value, out result);
return result;
}

Expand Down
4 changes: 1 addition & 3 deletions src/GitHub.Api/Git/GitCredentialManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ class GitCredentialManager : ICredentialManager
private ICredential credential;
private string credHelper = null;

private readonly IEnvironment environment;
private readonly IProcessManager processManager;
private readonly ITaskManager taskManager;

public GitCredentialManager(IEnvironment environment, IProcessManager processManager,
public GitCredentialManager(IProcessManager processManager,
ITaskManager taskManager)
{
this.environment = environment;
this.processManager = processManager;
this.taskManager = taskManager;
}
Expand Down
15 changes: 5 additions & 10 deletions src/GitHub.Api/Git/RepositoryManager.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace GitHub.Unity
Expand Down Expand Up @@ -94,13 +93,11 @@ public RepositoryPathConfiguration(NPath repositoryPath)

class RepositoryManager : IRepositoryManager
{
private readonly CancellationToken cancellationToken;
private readonly IGitConfig config;
private readonly IGitClient gitClient;
private readonly IPlatform platform;
private readonly IRepositoryPathConfiguration repositoryPaths;
private readonly ITaskManager taskManager;
private readonly IUsageTracker usageTracker;
private readonly IRepositoryWatcher watcher;

private bool isBusy;
Expand All @@ -119,23 +116,21 @@ class RepositoryManager : IRepositoryManager
public event Action<string, string> OnRemoteBranchRemoved;
public event Action<GitStatus> OnStatusUpdated;

public RepositoryManager(IPlatform platform, ITaskManager taskManager, IUsageTracker usageTracker, IGitConfig gitConfig,
public RepositoryManager(IPlatform platform, ITaskManager taskManager, IGitConfig gitConfig,
IRepositoryWatcher repositoryWatcher, IGitClient gitClient,
IRepositoryPathConfiguration repositoryPaths, CancellationToken cancellationToken)
IRepositoryPathConfiguration repositoryPaths)
{
this.repositoryPaths = repositoryPaths;
this.platform = platform;
this.taskManager = taskManager;
this.usageTracker = usageTracker;
this.cancellationToken = cancellationToken;
this.gitClient = gitClient;
this.watcher = repositoryWatcher;
this.config = gitConfig;

SetupWatcher();
}

public static RepositoryManager CreateInstance(IPlatform platform, ITaskManager taskManager, IUsageTracker usageTracker,
public static RepositoryManager CreateInstance(IPlatform platform, ITaskManager taskManager,
IGitClient gitClient, NPath repositoryRoot)
{
var repositoryPathConfiguration = new RepositoryPathConfiguration(repositoryRoot);
Expand All @@ -144,8 +139,8 @@ public static RepositoryManager CreateInstance(IPlatform platform, ITaskManager

var repositoryWatcher = new RepositoryWatcher(platform, repositoryPathConfiguration, taskManager.Token);

return new RepositoryManager(platform, taskManager, usageTracker, gitConfig, repositoryWatcher,
gitClient, repositoryPathConfiguration, taskManager.Token);
return new RepositoryManager(platform, taskManager, gitConfig, repositoryWatcher,
gitClient, repositoryPathConfiguration);
}

public void Initialize()
Expand Down
1 change: 0 additions & 1 deletion src/GitHub.Api/Helpers/SimpleJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,6 @@ static class SimpleJson

private static readonly char[] EscapeTable;
private static readonly char[] EscapeCharacters = new char[] { '"', '\\', '\b', '\f', '\n', '\r', '\t' };
private static readonly string EscapeCharactersString = new string(EscapeCharacters);

static SimpleJson()
{
Expand Down
1 change: 0 additions & 1 deletion src/GitHub.Api/NewTaskSystem/BaseOutputProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ public override void LineReceived(string line)

abstract class FirstResultOutputProcessor<T> : BaseOutputProcessor<T>
{
private readonly StringBuilder sb = new StringBuilder();
private bool isSet = false;
public override void LineReceived(string line)
{
Expand Down
2 changes: 1 addition & 1 deletion src/GitHub.Api/Platform/Platform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public IPlatform Initialize(IProcessManager processManager, ITaskManager taskMan

if (CredentialManager == null)
{
CredentialManager = new GitCredentialManager(Environment, processManager, taskManager);
CredentialManager = new GitCredentialManager(processManager, taskManager);
Keychain = new Keychain(Environment, CredentialManager);
Keychain.Initialize();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ sealed class EnvironmentCache : ScriptObjectSingleton<EnvironmentCache>
[SerializeField] private string unityApplication;
[SerializeField] private string unityAssetsPath;
[SerializeField] private string extensionInstallPath;
[SerializeField] private string gitExecutablePath;
[SerializeField] private string unityVersion;

[NonSerialized] private IEnvironment environment;
Expand Down Expand Up @@ -80,7 +79,6 @@ public void Flush()
unityApplication = Environment.UnityApplication;
unityAssetsPath = Environment.UnityAssetsPath;
extensionInstallPath = Environment.ExtensionInstallPath;
gitExecutablePath = Environment.GitExecutablePath;
Save(true);
}
}
Expand Down
16 changes: 0 additions & 16 deletions src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ class Styles

private const string WarningLabel = "<b>Warning:</b> {0}";

private static Color headerGreyColor = new Color(0.878f, 0.878f, 0.878f, 1.0f);

private static GUIStyle label,
boldLabel,
errorLabel,
Expand Down Expand Up @@ -97,8 +95,6 @@ class Styles
lockIcon,
dropdownListIcon;

private static Color timelineBarColor;

public static Texture2D GetFileStatusIcon(GitFileStatus status, bool isLocked)
{
if (isLocked)
Expand Down Expand Up @@ -597,18 +593,6 @@ public static GUIStyle GenericBoxStyle
}
}

public static Color TimelineBarColor
{
get
{
if (timelineBarColor == null)
{
timelineBarColor = new Color(0.51F, 0.51F, 0.51F, 0.2F);
}
return timelineBarColor;
}
}

public static Texture2D ActiveBranchIcon
{
get
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using GitHub.Unity;
using System;
using System.Threading;
using UnityEditor;
Expand All @@ -7,8 +6,6 @@ namespace GitHub.Unity
{
class MainThreadSynchronizationContext : SynchronizationContext, IMainThreadSynchronizationContext
{
private static readonly ILogging logger = Logging.GetLogger<MainThreadSynchronizationContext>();

public void Schedule(Action action)
{
Guard.ArgumentNotNull(action, "action");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ namespace GitHub.Unity
abstract class BaseWindow : EditorWindow, IView
{
[NonSerialized] private bool initialized = false;
[NonSerialized] private IApplicationManager cachedManager;
[NonSerialized] private IRepository cachedRepository;
[NonSerialized] private bool initializeWasCalled;
[NonSerialized] private bool inLayout;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class HistoryView : Subview

[NonSerialized] private int historyStartIndex;
[NonSerialized] private int historyStopIndex;
[NonSerialized] private float lastWidth;
[NonSerialized] private int listID;
[NonSerialized] private int newSelectionIndex;
[NonSerialized] private float scrollOffset;
Expand All @@ -60,7 +59,6 @@ public override void InitializeView(IView parent)
{
base.InitializeView(parent);

lastWidth = Position.width;
selectionIndex = newSelectionIndex = -1;

changesetTree.InitializeView(this);
Expand Down Expand Up @@ -453,15 +451,13 @@ private void RevertCommit()
private bool HistoryEntry(GitLogEntry entry, LogEntryState state, bool selected)
{
var entryRect = GUILayoutUtility.GetRect(Styles.HistoryEntryHeight, Styles.HistoryEntryHeight);
var timelineBarRect = new Rect(entryRect.x + Styles.BaseSpacing, 0, 2, Styles.HistoryDetailsHeight);

if (Event.current.type == EventType.Repaint)
{
var keyboardFocus = GUIUtility.keyboardControl == listID;

var summaryRect = new Rect(entryRect.x, entryRect.y + (Styles.BaseSpacing / 2), entryRect.width, Styles.HistorySummaryHeight + Styles.BaseSpacing);
var timestampRect = new Rect(entryRect.x, entryRect.yMax - Styles.HistoryDetailsHeight - (Styles.BaseSpacing / 2), entryRect.width, Styles.HistoryDetailsHeight);
var authorRect = new Rect(timestampRect.xMax, timestampRect.y, timestampRect.width, timestampRect.height);

var contentOffset = new Vector2(Styles.BaseSpacing * 2, 0);

Expand Down Expand Up @@ -610,7 +606,6 @@ private void Push()

private void Fetch()
{
var remote = Repository.CurrentRemote.HasValue ? Repository.CurrentRemote.Value.Name : String.Empty;
Repository
.Fetch()
.FinallyInUI((success, e) => {
Expand Down
11 changes: 0 additions & 11 deletions src/UnityExtension/Assets/Editor/GitHub.Unity/UI/SettingsView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace GitHub.Unity
[Serializable]
class SettingsView : Subview
{
private const string GitInstallTitle = "Git installation";
private const string GitRepositoryTitle = "Repository Configuration";
private const string GitRepositoryRemoteLabel = "Remote";
private const string GitRepositorySave = "Save Repository";
Expand All @@ -20,15 +19,9 @@ class SettingsView : Subview
private const string EnableTraceLoggingLabel = "Enable Trace Logging";
private const string MetricsOptInLabel = "Help us improve by sending anonymous usage data";
private const string DefaultRepositoryRemoteName = "origin";
private const string BrowseButton = "...";
private const string PathToGit = "Path to Git";
private const string GitPathSaveButton = "Save Path";

[NonSerialized] private int newGitIgnoreRulesSelection = -1;
[NonSerialized] private bool isBusy;

[SerializeField] private int gitIgnoreRulesSelection = 0;
[SerializeField] private string initDirectory;
[SerializeField] private List<GitLock> lockedFiles = new List<GitLock>();
[SerializeField] private Vector2 lockScrollPos;
[SerializeField] private string repositoryRemoteName;
Expand All @@ -39,16 +32,12 @@ class SettingsView : Subview
[NonSerialized] private bool remoteHasChanged;
[NonSerialized] private bool locksHaveChanged;

[SerializeField] private string newGitName;
[SerializeField] private string newGitEmail;
[SerializeField] private string newRepositoryRemoteUrl;
[SerializeField] private User cachedUser;

[SerializeField] private bool metricsEnabled;
[NonSerialized] private bool metricsHasChanged;

[SerializeField] private GitPathView gitPathView = new GitPathView();

[SerializeField] private UserSettingsView userSettingsView = new UserSettingsView();

public override void InitializeView(IView parent)
Expand Down
2 changes: 1 addition & 1 deletion src/UnityExtension/Assets/Editor/GitHub.Unity/UI/Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ private void DoHeaderGUI()
private void DoToolbarGUI()
{
// Subtabs & toolbar
Rect mainNavRect = EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
GUILayout.BeginHorizontal(EditorStyles.toolbar);
{
changeTab = activeTab;
EditorGUI.BeginChangeCheck();
Expand Down
Loading