Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 077d55e

Browse files
authored
Merge branch 'master' into fixes/1052-added-comment-not-found
2 parents af9dfaa + 3654a52 commit 077d55e

24 files changed

+350
-127
lines changed

GitHubVS.sln

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.26403.7
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.25420.1
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitHub.VisualStudio", "src\GitHub.VisualStudio\GitHub.VisualStudio.csproj", "{11569514-5AE5-4B5B-92A2-F10B0967DE5F}"
77
ProjectSection(ProjectDependencies) = postProject

src/GitHub.App/Factories/HostCacheFactory.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
using System;
22
using System.ComponentModel.Composition;
33
using System.IO;
4+
using System.Reactive.Linq;
45
using Akavache;
56
using GitHub.Primitives;
67
using Rothko;
78
using GitHub.Extensions;
9+
using System.Threading.Tasks;
810

911
namespace GitHub.Factories
1012
{
1113
[Export(typeof(IHostCacheFactory))]
1214
[PartCreationPolicy(CreationPolicy.Shared)]
1315
public class HostCacheFactory : IHostCacheFactory
1416
{
17+
const int CacheVersion = 1;
18+
const string CacheVersionKey = "cacheVersion";
19+
1520
readonly Lazy<IBlobCacheFactory> blobCacheFactory;
1621
readonly Lazy<IOperatingSystem> operatingSystem;
1722

@@ -22,7 +27,7 @@ public HostCacheFactory(Lazy<IBlobCacheFactory> blobCacheFactory, Lazy<IOperatin
2227
this.operatingSystem = operatingSystem;
2328
}
2429

25-
public IBlobCache Create(HostAddress hostAddress)
30+
public async Task<IBlobCache> Create(HostAddress hostAddress)
2631
{
2732
var environment = OperatingSystem.Environment;
2833
// For GitHub.com, the cache file name should be "api.github.com.cache.db"
@@ -34,7 +39,17 @@ public IBlobCache Create(HostAddress hostAddress)
3439

3540
// CreateDirectory is a noop if the directory already exists.
3641
OperatingSystem.Directory.CreateDirectory(Path.GetDirectoryName(userAccountPath));
37-
return BlobCacheFactory.CreateBlobCache(userAccountPath);
42+
43+
var cache = BlobCacheFactory.CreateBlobCache(userAccountPath);
44+
var version = await cache.GetOrCreateObject<int>(CacheVersionKey, () => 0);
45+
46+
if (version != CacheVersion)
47+
{
48+
await cache.InvalidateAll();
49+
await cache.InsertObject(CacheVersionKey, CacheVersion);
50+
}
51+
52+
return cache;
3853
}
3954

4055
IOperatingSystem OperatingSystem { get { return operatingSystem.Value; } }
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
using Akavache;
22
using GitHub.Primitives;
33
using System;
4+
using System.Threading.Tasks;
45

56
namespace GitHub.Factories
67
{
78
public interface IHostCacheFactory : IDisposable
89
{
9-
IBlobCache Create(HostAddress hostAddress);
10+
Task<IBlobCache> Create(HostAddress hostAddress);
1011
}
1112
}

src/GitHub.App/Factories/RepositoryHostFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public RepositoryHostFactory(
4444
public async Task<IRepositoryHost> Create(HostAddress hostAddress)
4545
{
4646
var apiClient = await apiClientFactory.Create(hostAddress);
47-
var hostCache = hostCacheFactory.Create(hostAddress);
47+
var hostCache = await hostCacheFactory.Create(hostAddress);
4848
var modelService = new ModelService(apiClient, hostCache, avatarProvider);
4949
var host = new RepositoryHost(apiClient, modelService, loginManager, loginCache, usage);
5050
hosts.Add(host);

src/GitHub.App/Services/GitClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ public Task<string> ExtractFile(IRepository repository, string commitSha, string
296296
return Task.Factory.StartNew(() =>
297297
{
298298
var commit = repository.Lookup<Commit>(commitSha);
299-
if(commit == null)
299+
if (commit == null)
300300
{
301301
throw new FileNotFoundException("Couldn't find '" + fileName + "' at commit " + commitSha + ".");
302302
}

src/GitHub.App/ViewModels/RepositoryCloneViewModel.cs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,17 @@ public override void Initialize([AllowNull] ViewWithData data)
125125

126126
IsBusy = true;
127127
repositoryHost.ModelService.GetRepositories(repositories);
128-
repositories.OriginalCompleted.Subscribe(
129-
_ => { }
130-
, ex =>
131-
{
132-
LoadingFailed = true;
133-
IsBusy = false;
134-
log.Error("Error while loading repositories", ex);
135-
},
136-
() => IsBusy = false
128+
repositories.OriginalCompleted
129+
.ObserveOn(RxApp.MainThreadScheduler)
130+
.Subscribe(
131+
_ => { }
132+
, ex =>
133+
{
134+
LoadingFailed = true;
135+
IsBusy = false;
136+
log.Error("Error while loading repositories", ex);
137+
},
138+
() => IsBusy = false
137139
);
138140
repositories.Subscribe();
139141
}

src/GitHub.Extensions/StringExtensions.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -180,21 +180,6 @@ public static string Wrap(this string text, int maxLength = 72)
180180
return sb.ToString();
181181
}
182182

183-
public static bool EqualsIgnoringLineEndings(this string a, string b)
184-
{
185-
if (ReferenceEquals(a, b))
186-
return true;
187-
188-
if (a == null || b == null)
189-
return false;
190-
191-
// TODO: Write a non-allocating comparison.
192-
a = a.Replace("\r\n", "\n");
193-
b = b.Replace("\r\n", "\n");
194-
195-
return a == b;
196-
}
197-
198183
public static Uri ToUriSafe(this string url)
199184
{
200185
Uri uri;

src/GitHub.InlineReviews/Commands/InlineCommentNavigationCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public override bool IsEnabled
4949
get
5050
{
5151
var tags = GetTags(GetCurrentTextViews());
52-
return tags.Count > 1;
52+
return tags.Count > 0;
5353
}
5454
}
5555

src/GitHub.InlineReviews/GitHub.InlineReviews.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
<Compile Include="InlineReviewsPackage.cs" />
8383
<Compile Include="Models\InlineCommentThreadModel.cs" />
8484
<Compile Include="Models\PullRequestSessionFile.cs" />
85+
<Compile Include="Tags\MouseEnterAndLeaveEventRouter.cs" />
8586
<Compile Include="Peek\InlineCommentPeekableItem.cs" />
8687
<Compile Include="Peek\InlineCommentPeekableItemSource.cs" />
8788
<Compile Include="Peek\InlineCommentPeekableItemSourceProvider.cs" />

src/GitHub.InlineReviews/Glyph/GlyphData.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
namespace GitHub.InlineReviews.Glyph.Implementation
77
{
8+
/// <summary>
9+
/// Information about the position of a glyph.
10+
/// </summary>
11+
/// <typeparam name="TGlyphTag">The type of glyph tag we're dealing with.</typeparam>
812
internal class GlyphData<TGlyphTag>
913
{
1014
double deltaY;

0 commit comments

Comments
 (0)