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

Commit 12dc458

Browse files
authored
Merge branch 'master' into task/auto-detect-tests
2 parents 0f09169 + b62034a commit 12dc458

File tree

31 files changed

+729
-67
lines changed

31 files changed

+729
-67
lines changed

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '2.4.0.{build}'
1+
version: '2.4.2.{build}'
22
skip_tags: true
33
install:
44
- ps: |

src/GitHub.App/Caches/CacheIndex.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public static IObservable<CacheIndex> AddAndSaveToIndex(IBlobCache cache, string
6262
Guard.ArgumentNotNull(item, nameof(item));
6363

6464
return cache.GetOrCreateObject(indexKey, () => Create(indexKey))
65+
.Select(x => x.IndexKey == null ? Create(indexKey) : x)
6566
.Do(index =>
6667
{
6768
var k = string.Format(CultureInfo.InvariantCulture, "{0}|{1}", index.IndexKey, item.Key);

src/GitHub.App/Extensions/AkavacheExtensions.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,11 @@ static IObservable<T> GetAndFetchLatestFromIndex<T>(this IBlobCache This,
200200
bool shouldInvalidateOnError = false)
201201
where T : CacheItem
202202
{
203-
var idx = Observable.Defer(() => This.GetOrCreateObject(key, () => CacheIndex.Create(key))).Replay().RefCount();
203+
var idx = Observable.Defer(() => This
204+
.GetOrCreateObject(key, () => CacheIndex.Create(key)))
205+
.Select(x => x.IndexKey == null ? CacheIndex.Create(key) : x)
206+
.Replay()
207+
.RefCount();
204208

205209

206210
var fetch = idx
@@ -264,6 +268,7 @@ public static IObservable<T> PutAndUpdateIndex<T>(this IBlobCache blobCache,
264268
{
265269
var absoluteExpiration = blobCache.Scheduler.Now + maxCacheDuration;
266270
return blobCache.GetOrCreateObject(key, () => CacheIndex.Create(key))
271+
.Select(x => x.IndexKey == null ? CacheIndex.Create(key) : x)
267272
.SelectMany(index => fetchFunc()
268273
.Catch<T, Exception>(Observable.Throw<T>)
269274
.SelectMany(x => x.Save<T>(blobCache, key, absoluteExpiration))

src/GitHub.App/GitHub.App.csproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@
6161
<HintPath>..\..\packages\Microsoft.VisualStudio.ComponentModelHost.14.0.25424\lib\net45\Microsoft.VisualStudio.ComponentModelHost.dll</HintPath>
6262
<Private>True</Private>
6363
</Reference>
64+
<Reference Include="Microsoft.VisualStudio.OLE.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
65+
<HintPath>..\..\packages\Microsoft.VisualStudio.OLE.Interop.7.10.6070\lib\Microsoft.VisualStudio.OLE.Interop.dll</HintPath>
66+
<Private>True</Private>
67+
</Reference>
6468
<Reference Include="Microsoft.VisualStudio.Shell.14.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
6569
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.14.0.14.3.25407\lib\Microsoft.VisualStudio.Shell.14.0.dll</HintPath>
6670
<Private>True</Private>
@@ -69,10 +73,18 @@
6973
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.Immutable.10.0.10.0.30319\lib\net40\Microsoft.VisualStudio.Shell.Immutable.10.0.dll</HintPath>
7074
<Private>True</Private>
7175
</Reference>
76+
<Reference Include="Microsoft.VisualStudio.Shell.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
77+
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.Interop.7.10.6071\lib\Microsoft.VisualStudio.Shell.Interop.dll</HintPath>
78+
<Private>True</Private>
79+
</Reference>
7280
<Reference Include="Microsoft.VisualStudio.TextManager.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
7381
<HintPath>..\..\packages\Microsoft.VisualStudio.TextManager.Interop.7.10.6070\lib\Microsoft.VisualStudio.TextManager.Interop.dll</HintPath>
7482
<Private>True</Private>
7583
</Reference>
84+
<Reference Include="Microsoft.VisualStudio.TextManager.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
85+
<HintPath>..\..\packages\Microsoft.VisualStudio.TextManager.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.TextManager.Interop.8.0.dll</HintPath>
86+
<Private>True</Private>
87+
</Reference>
7688
<Reference Include="Microsoft.VisualStudio.Threading, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
7789
<SpecificVersion>False</SpecificVersion>
7890
<HintPath>..\..\packages\Microsoft.VisualStudio.Threading.14.1.131\lib\net45\Microsoft.VisualStudio.Threading.dll</HintPath>

src/GitHub.App/ViewModels/GitHubPane/NavigationViewModel.cs

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public class NavigationViewModel : ViewModelBase, INavigationViewModel
2525
public NavigationViewModel()
2626
{
2727
history = new ReactiveList<IPanePageViewModel>();
28-
history.BeforeItemsAdded.Subscribe(BeforeItemAdded);
29-
history.CollectionChanged += CollectionChanged;
28+
history.Changing.Subscribe(CollectionChanging);
29+
history.Changed.Subscribe(CollectionChanged);
3030

3131
var pos = this.WhenAnyValue(
3232
x => x.Index,
@@ -107,7 +107,7 @@ public bool Forward()
107107
public void Clear()
108108
{
109109
Index = -1;
110-
history.RemoveRange(0, history.Count);
110+
history.Clear();
111111
}
112112

113113
public int RemoveAll(IPanePageViewModel page)
@@ -139,27 +139,34 @@ void ItemRemoved(int removedIndex, IPanePageViewModel page)
139139
}
140140
}
141141

142-
void CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
142+
void CollectionChanging(NotifyCollectionChangedEventArgs e)
143143
{
144-
using (DelayChangeNotifications())
144+
if (e.Action == NotifyCollectionChangedAction.Add)
145145
{
146-
switch (e.Action)
146+
foreach (IPanePageViewModel page in e.NewItems)
147147
{
148-
case NotifyCollectionChangedAction.Add:
149-
break;
150-
151-
case NotifyCollectionChangedAction.Remove:
152-
for (var i = 0; i < e.OldItems.Count; ++i)
153-
{
154-
ItemRemoved(e.OldStartingIndex + i, (IPanePageViewModel)e.OldItems[i]);
155-
}
156-
break;
157-
158-
case NotifyCollectionChangedAction.Reset:
159-
throw new NotSupportedException();
148+
BeforeItemAdded(page);
149+
}
150+
}
151+
else if (e.Action == NotifyCollectionChangedAction.Reset)
152+
{
153+
foreach (var page in history)
154+
{
155+
page.Dispose();
156+
}
157+
}
158+
}
160159

161-
default:
162-
throw new NotImplementedException();
160+
void CollectionChanged(NotifyCollectionChangedEventArgs e)
161+
{
162+
using (DelayChangeNotifications())
163+
{
164+
if (e.Action == NotifyCollectionChangedAction.Remove)
165+
{
166+
for (var i = 0; i < e.OldItems.Count; ++i)
167+
{
168+
ItemRemoved(e.OldStartingIndex + i, (IPanePageViewModel)e.OldItems[i]);
169+
}
163170
}
164171
}
165172
}

src/GitHub.App/packages.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
<package id="LibGit2Sharp" version="0.23.1" targetFramework="net461" />
44
<package id="LibGit2Sharp.NativeBinaries" version="1.0.164" targetFramework="net461" />
55
<package id="Microsoft.VisualStudio.ComponentModelHost" version="14.0.25424" targetFramework="net461" />
6+
<package id="Microsoft.VisualStudio.OLE.Interop" version="7.10.6070" targetFramework="net461" />
67
<package id="Microsoft.VisualStudio.Shell.14.0" version="14.3.25407" targetFramework="net461" />
78
<package id="Microsoft.VisualStudio.Shell.Immutable.10.0" version="10.0.30319" targetFramework="net461" />
9+
<package id="Microsoft.VisualStudio.Shell.Interop" version="7.10.6071" targetFramework="net461" />
810
<package id="Microsoft.VisualStudio.TextManager.Interop" version="7.10.6070" targetFramework="net461" />
11+
<package id="Microsoft.VisualStudio.TextManager.Interop.8.0" version="8.0.50727" targetFramework="net461" />
912
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
1013
<package id="Rothko" version="0.0.3-ghfvs" targetFramework="net461" />
1114
<package id="Rx-Core" version="2.2.5-custom" targetFramework="net45" />

src/GitHub.Exports.Reactive/GitHub.Exports.Reactive.csproj

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,46 @@
5757
<HintPath>..\..\packages\Microsoft.VisualStudio.CoreUtility.14.3.25407\lib\net45\Microsoft.VisualStudio.CoreUtility.dll</HintPath>
5858
<Private>True</Private>
5959
</Reference>
60+
<Reference Include="Microsoft.VisualStudio.Imaging, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
61+
<HintPath>..\..\packages\Microsoft.VisualStudio.Imaging.14.3.25407\lib\net45\Microsoft.VisualStudio.Imaging.dll</HintPath>
62+
<Private>True</Private>
63+
</Reference>
64+
<Reference Include="Microsoft.VisualStudio.OLE.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
65+
<HintPath>..\..\packages\Microsoft.VisualStudio.OLE.Interop.7.10.6070\lib\Microsoft.VisualStudio.OLE.Interop.dll</HintPath>
66+
<Private>True</Private>
67+
</Reference>
68+
<Reference Include="Microsoft.VisualStudio.Shell.14.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
69+
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.14.0.14.3.25407\lib\Microsoft.VisualStudio.Shell.14.0.dll</HintPath>
70+
<Private>True</Private>
71+
</Reference>
72+
<Reference Include="Microsoft.VisualStudio.Shell.Immutable.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
73+
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.Immutable.10.0.10.0.30319\lib\net40\Microsoft.VisualStudio.Shell.Immutable.10.0.dll</HintPath>
74+
<Private>True</Private>
75+
</Reference>
76+
<Reference Include="Microsoft.VisualStudio.Shell.Immutable.11.0, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
77+
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.Immutable.11.0.11.0.50727\lib\net45\Microsoft.VisualStudio.Shell.Immutable.11.0.dll</HintPath>
78+
<Private>True</Private>
79+
</Reference>
80+
<Reference Include="Microsoft.VisualStudio.Shell.Immutable.12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
81+
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.Immutable.12.0.12.0.21003\lib\net45\Microsoft.VisualStudio.Shell.Immutable.12.0.dll</HintPath>
82+
<Private>True</Private>
83+
</Reference>
84+
<Reference Include="Microsoft.VisualStudio.Shell.Immutable.14.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
85+
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.Immutable.14.0.14.3.25407\lib\net45\Microsoft.VisualStudio.Shell.Immutable.14.0.dll</HintPath>
86+
<Private>True</Private>
87+
</Reference>
88+
<Reference Include="Microsoft.VisualStudio.Shell.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
89+
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.Interop.7.10.6071\lib\Microsoft.VisualStudio.Shell.Interop.dll</HintPath>
90+
<Private>True</Private>
91+
</Reference>
92+
<Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
93+
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.Shell.Interop.8.0.dll</HintPath>
94+
<Private>True</Private>
95+
</Reference>
96+
<Reference Include="Microsoft.VisualStudio.Shell.Interop.9.0, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
97+
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30729\lib\Microsoft.VisualStudio.Shell.Interop.9.0.dll</HintPath>
98+
<Private>True</Private>
99+
</Reference>
60100
<Reference Include="Microsoft.VisualStudio.Text.Data, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
61101
<HintPath>..\..\packages\Microsoft.VisualStudio.Text.Data.14.3.25407\lib\net45\Microsoft.VisualStudio.Text.Data.dll</HintPath>
62102
<Private>True</Private>
@@ -69,6 +109,26 @@
69109
<HintPath>..\..\packages\Microsoft.VisualStudio.Text.UI.14.3.25407\lib\net45\Microsoft.VisualStudio.Text.UI.dll</HintPath>
70110
<Private>True</Private>
71111
</Reference>
112+
<Reference Include="Microsoft.VisualStudio.TextManager.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
113+
<HintPath>..\..\packages\Microsoft.VisualStudio.TextManager.Interop.7.10.6070\lib\Microsoft.VisualStudio.TextManager.Interop.dll</HintPath>
114+
<Private>True</Private>
115+
</Reference>
116+
<Reference Include="Microsoft.VisualStudio.TextManager.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
117+
<HintPath>..\..\packages\Microsoft.VisualStudio.TextManager.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.TextManager.Interop.8.0.dll</HintPath>
118+
<Private>True</Private>
119+
</Reference>
120+
<Reference Include="Microsoft.VisualStudio.Threading, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
121+
<HintPath>..\..\packages\Microsoft.VisualStudio.Threading.14.1.111\lib\net45\Microsoft.VisualStudio.Threading.dll</HintPath>
122+
<Private>True</Private>
123+
</Reference>
124+
<Reference Include="Microsoft.VisualStudio.Utilities, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
125+
<HintPath>..\..\packages\Microsoft.VisualStudio.Utilities.14.3.25407\lib\net45\Microsoft.VisualStudio.Utilities.dll</HintPath>
126+
<Private>True</Private>
127+
</Reference>
128+
<Reference Include="Microsoft.VisualStudio.Validation, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
129+
<HintPath>..\..\packages\Microsoft.VisualStudio.Validation.14.1.111\lib\net45\Microsoft.VisualStudio.Validation.dll</HintPath>
130+
<Private>True</Private>
131+
</Reference>
72132
<Reference Include="PresentationCore" />
73133
<Reference Include="System" />
74134
<Reference Include="System.ComponentModel.Composition" />
@@ -115,12 +175,14 @@
115175
<Compile Include="Models\PullRequestTextBufferInfo.cs" />
116176
<Compile Include="Services\IModelService.cs" />
117177
<Compile Include="Services\IGistPublishService.cs" />
178+
<Compile Include="Services\IPullRequestEditorService.cs" />
118179
<Compile Include="Services\IPullRequestSession.cs" />
119180
<Compile Include="Services\IPullRequestService.cs" />
120181
<Compile Include="Services\IPullRequestSessionManager.cs" />
121182
<Compile Include="Services\IShowDialogService.cs" />
122183
<Compile Include="Services\LocalRepositoriesExtensions.cs" />
123184
<Compile Include="Services\ModelServiceExtensions.cs" />
185+
<Compile Include="Services\PullRequestEditorService.cs" />
124186
<Compile Include="ViewModels\Dialog\IDialogContentViewModel.cs" />
125187
<Compile Include="ViewModels\Dialog\IGitHubDialogWindowViewModel.cs" />
126188
<Compile Include="ViewModels\Dialog\IGistCreationViewModel.cs" />
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using Microsoft.VisualStudio.TextManager.Interop;
2+
3+
namespace GitHub.Services
4+
{
5+
public interface IPullRequestEditorService
6+
{
7+
/// <summary>
8+
/// Find the active text view.
9+
/// </summary>
10+
/// <returns>The active view or null if view can't be found.</returns>
11+
IVsTextView FindActiveView();
12+
13+
/// <summary>
14+
/// Navigate to and place the caret at the best guess equivalent position in <see cref="targetFile"/>.
15+
/// </summary>
16+
/// <param name="sourceView">The text view to navigate from.</param>
17+
/// <param name="targetFile">The text view to open and navigate to.</param>
18+
/// <returns>The opened text view.</returns>
19+
IVsTextView NavigateToEquivalentPosition(IVsTextView sourceView, string targetFile);
20+
}
21+
}

0 commit comments

Comments
 (0)