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

Commit a873155

Browse files
Merge branch 'master' into fixes/long-publish-error-message
2 parents 80963a1 + 090f950 commit a873155

36 files changed

+196
-343
lines changed

GitHub.Unity.sln.DotSettings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@
342342
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAlwaysTreatStructAsNotReorderableMigration/@EntryIndexedValue">True</s:Boolean>
343343
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
344344
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
345+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EUnitTestFramework_002ESettings_002EMigrations_002ERemoveBuildPolicyAlwaysMigration/@EntryIndexedValue">True</s:Boolean>
345346
<s:Boolean x:Key="/Default/Environment/UnitTesting/ShadowCopy/@EntryValue">False</s:Boolean>
346347
<s:String x:Key="/Default/Housekeeping/UnitTestingMru/UnitTestSessionDefault/PlatformType/@EntryValue">x64</s:String>
347348
</wpf:ResourceDictionary>

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ The GitHub for Unity extension brings [Git](https://git-scm.com/) and GitHub int
4747

4848
### Requirements
4949

50-
- Unity 5.4-5.6
51-
- We've only tested the extension so far on Unity 5.4 to 5.6. There's currently an blocker issue opened for 5.3 support, so we know it doesn't run there. There are some issues for 2017.x, so it may or may not run well on that version. Personal edition is fine.
50+
- Unity 5.4-2017.1
51+
- We've only tested the extension so far on Unity 5.4 to 2017.1. There's currently an blocker issue opened for 5.3 support, so we know it doesn't run there. There are some issues for 2017.2, so it may or may not run well on that version. Personal edition is fine.
5252
- Git and Git LFS 2.x
5353

5454
#### Git on macOS

docs/contributing/how-to-build.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ This repository is LFS-enabled. To clone it, you should use a git client that su
99
- Visual Studio 2015+ or Mono 4.x + bash shell (git bash).
1010
- Mono 5.x will not work
1111
- `UnityEngine.dll` and `UnityEditor.dll`.
12-
- If you've installed Unity in the default location of `C:\Program Files\Unity` or `C:\Program Files (x86)\Unity`, the build will be able to reference these DLLs automatically. Otherwise, you'll need to copy these DLLs from your Unity installation into the `lib` directory in order for the build to work
12+
- If you've installed Unity in the default location of `C:\Program Files\Unity` or `C:\Program Files (x86)\Unity`, the build will be able to reference these DLLs automatically. Otherwise, you'll need to copy these DLLs from `[Unity installation path]\Unity\Editor\Data\Managed` into the `lib` directory in order for the build to work
1313

1414
### MacOS
1515

1616
- Mono 4.x required.
1717
- Mono 5.x will not work
1818
- `UnityEngine.dll` and `UnityEditor.dll`.
19-
- If you've installed Unity in the default location of `/Applications/Unity`, the build will be able to reference these DLLs automatically. Otherwise, you'll need to copy these DLLs from your Unity installation into the `lib` directory in order for the build to work
19+
- If you've installed Unity in the default location of `/Applications/Unity`, the build will be able to reference these DLLs automatically. Otherwise, you'll need to copy these DLLs from `[Unity installation path]/Unity.app/Contents/Managed` into the `lib` directory in order for the build to work
2020

2121
## How to Build
2222

@@ -40,11 +40,11 @@ To be able to authenticate in GitHub for Unity, you'll need to:
4040
- [Register a new developer application](https://github.com/settings/developers) in your profile.
4141
- Copy [common/ApplicationInfo_Local.cs-example](../../common/ApplicationInfo_Local.cs-example) to `common/ApplicationInfo_Local.cs` and fill out the clientId/clientSecret fields for your application.
4242

43-
The build needs to reference `UnityEngine.dll` and `UnityEditor.dll`. These DLLs are included with Unity. If you've installed Unity in the default location, the build will be able to find them automatically. If not, copy these DLLs from your Unity installation into the `lib` directory in order for the build to work.
43+
The build needs to reference `UnityEngine.dll` and `UnityEditor.dll`. These DLLs are included with Unity. If you've installed Unity in the default location, the build will be able to find them automatically. If not, copy these DLLs from `[your Unity installation path]\Unity\Editor\Data\Managed` into the `lib` directory in order for the build to work.
4444

4545
### Visual Studio
4646

47-
To build with Visual Studio 2015 open the solution file `GitHub.Unity.sln`. Select `Build Solution` in the `Build` menu.
47+
To build with Visual Studio 2015+, open the solution file `GitHub.Unity.sln`. Select `Build Solution` in the `Build` menu.
4848

4949
### Mono and Bash (windows and mac)
5050

src/GitHub.Api/Application/ApiClient.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4-
using System.Threading;
54
using System.Threading.Tasks;
65
using Octokit;
76

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

3230
IList<Organization> organizationsCache;
3331
Octokit.User userCache;
3432

35-
string owner;
36-
bool? isEnterprise;
37-
3833
public ApiClient(UriString hostUrl, IKeychain keychain, IGitHubClient githubClient)
3934
{
4035
Guard.ArgumentNotNull(hostUrl, nameof(hostUrl));

src/GitHub.Api/Application/ApplicationManagerBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected void Initialize()
3939
Logging.TracingEnabled = UserSettings.Get(Constants.TraceLoggingKey, false);
4040
ProcessManager = new ProcessManager(Environment, Platform.GitEnvironment, CancellationToken);
4141
Platform.Initialize(ProcessManager, TaskManager);
42-
GitClient = new GitClient(Environment, ProcessManager, Platform.CredentialManager, TaskManager);
42+
GitClient = new GitClient(Environment, ProcessManager, TaskManager);
4343
SetupMetrics();
4444
}
4545

@@ -127,7 +127,7 @@ public void RestartRepository()
127127
{
128128
if (Environment.RepositoryPath != null)
129129
{
130-
repositoryManager = Unity.RepositoryManager.CreateInstance(Platform, TaskManager, UsageTracker, GitClient, Environment.RepositoryPath);
130+
repositoryManager = Unity.RepositoryManager.CreateInstance(Platform, TaskManager, GitClient, Environment.RepositoryPath);
131131
repositoryManager.Initialize();
132132
Environment.Repository.Initialize(repositoryManager);
133133
repositoryManager.Start();

src/GitHub.Api/Events/RepositoryWatcher.cs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@ class RepositoryWatcher : IRepositoryWatcher
3030
private readonly CancellationToken cancellationToken;
3131
private readonly NPath[] ignoredPaths;
3232
private readonly ManualResetEventSlim pauseEvent;
33-
private readonly bool disableNative;
3433
private NativeInterface nativeInterface;
3534
private bool running;
36-
private Task task;
3735
private int lastCountOfProcessedEvents = 0;
3836
private bool processingEvents;
3937
private readonly ManualResetEventSlim signalProcessingEventsDone = new ManualResetEventSlim(false);
@@ -68,8 +66,7 @@ public void Initialize()
6866

6967
try
7068
{
71-
if (!disableNative)
72-
nativeInterface = new NativeInterface(pathsRepositoryPath);
69+
nativeInterface = new NativeInterface(pathsRepositoryPath);
7370
}
7471
catch (Exception ex)
7572
{
@@ -79,12 +76,6 @@ public void Initialize()
7976

8077
public void Start()
8178
{
82-
if (disableNative)
83-
{
84-
Logger.Trace("Native interface is disabled");
85-
return;
86-
}
87-
8879
if (nativeInterface == null)
8980
{
9081
Logger.Warning("NativeInterface is null");
@@ -95,7 +86,7 @@ public void Start()
9586

9687
running = true;
9788
pauseEvent.Reset();
98-
task = Task.Factory.StartNew(WatcherLoop, cancellationToken, TaskCreationOptions.None, TaskScheduler.Default);
89+
Task.Factory.StartNew(WatcherLoop, cancellationToken, TaskCreationOptions.None, TaskScheduler.Default);
9990
}
10091

10192
public void Stop()

src/GitHub.Api/Git/GitClient.cs

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ ITask<string> GetConfig(string key, GitConfigSource configSource,
2323
ITask<string> SetConfig(string key, string value, GitConfigSource configSource,
2424
IOutputProcessor<string> processor = null);
2525

26+
ITask<string[]> GetConfigUserAndEmail();
27+
2628
ITask<List<GitLock>> ListLocks(bool local,
2729
BaseOutputListProcessor<GitLock> processor = null);
2830

@@ -87,16 +89,13 @@ class GitClient : IGitClient
8789
{
8890
private readonly IEnvironment environment;
8991
private readonly IProcessManager processManager;
90-
private readonly ICredentialManager credentialManager;
9192
private readonly ITaskManager taskManager;
9293
private readonly CancellationToken cancellationToken;
9394

94-
public GitClient(IEnvironment environment, IProcessManager processManager,
95-
ICredentialManager credentialManager, ITaskManager taskManager)
95+
public GitClient(IEnvironment environment, IProcessManager processManager, ITaskManager taskManager)
9696
{
9797
this.environment = environment;
9898
this.processManager = processManager;
99-
this.credentialManager = credentialManager;
10099
this.taskManager = taskManager;
101100
this.cancellationToken = taskManager.Token;
102101
}
@@ -242,7 +241,7 @@ public ITask<Version> LfsVersion(IOutputProcessor<Version> processor = null)
242241

243242
public ITask<string> GetConfig(string key, GitConfigSource configSource, IOutputProcessor<string> processor = null)
244243
{
245-
Logger.Trace("GetConfig");
244+
Logger.Trace("GetConfig: {0}", key);
246245

247246
return new GitConfigGetTask(key, configSource, cancellationToken, processor)
248247
.Configure(processManager);
@@ -256,6 +255,28 @@ public ITask<string> SetConfig(string key, string value, GitConfigSource configS
256255
.Configure(processManager);
257256
}
258257

258+
public ITask<string[]> GetConfigUserAndEmail()
259+
{
260+
string username = null;
261+
string email = null;
262+
263+
return GetConfig("user.name", GitConfigSource.User).Then((success, value) => {
264+
if (success)
265+
{
266+
username = value;
267+
}
268+
269+
}).Then(GetConfig("user.email", GitConfigSource.User).Then((success, value) => {
270+
if (success)
271+
{
272+
email = value;
273+
}
274+
})).Then(success => {
275+
Logger.Trace("user.name:{1} user.email:{2}", success, username, email);
276+
return new[] { username, email };
277+
});
278+
}
279+
259280
public ITask<List<GitLock>> ListLocks(bool local, BaseOutputListProcessor<GitLock> processor = null)
260281
{
261282
Logger.Trace("ListLocks");

src/GitHub.Api/Git/GitConfig.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,16 +216,16 @@ public string GetString(string key)
216216
public int GetInt(string key)
217217
{
218218
var value = this[key];
219-
var result = 0;
220-
var success = int.TryParse(value, out result);
219+
int result = 0;
220+
int.TryParse(value, out result);
221221
return result;
222222
}
223223

224224
public float GetFloat(string key)
225225
{
226226
var value = this[key];
227-
var result = 0F;
228-
var success = float.TryParse(value, out result);
227+
float result = 0F;
228+
float.TryParse(value, out result);
229229
return result;
230230
}
231231

src/GitHub.Api/Git/GitCredentialManager.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@ class GitCredentialManager : ICredentialManager
1111
private ICredential credential;
1212
private string credHelper = null;
1313

14-
private readonly IEnvironment environment;
1514
private readonly IProcessManager processManager;
1615
private readonly ITaskManager taskManager;
1716

18-
public GitCredentialManager(IEnvironment environment, IProcessManager processManager,
17+
public GitCredentialManager(IProcessManager processManager,
1918
ITaskManager taskManager)
2019
{
21-
this.environment = environment;
2220
this.processManager = processManager;
2321
this.taskManager = taskManager;
2422
}

src/GitHub.Api/Git/Repository.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public ITask SetupRemote(string remote, string remoteUrl)
8585
public ITask<List<GitLogEntry>> Log()
8686
{
8787
if (repositoryManager == null)
88-
return new FuncListTask<GitLogEntry>(TaskHelpers.GetCompletedTask(new List<GitLogEntry>()));
88+
return new FuncListTask<GitLogEntry>(new NotReadyException().ToTask<List<GitLogEntry>>());
8989

9090
return repositoryManager.Log();
9191
}
@@ -123,7 +123,7 @@ public ITask Revert(string changeset)
123123
public ITask ListLocks()
124124
{
125125
if (repositoryManager == null)
126-
return new ActionTask(TaskExtensions.CompletedTask);
126+
return new ActionTask(new NotReadyException().ToTask<bool>());
127127
return repositoryManager.ListLocks(false);
128128
}
129129

0 commit comments

Comments
 (0)