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

Commit 00becf9

Browse files
committed
Merge branch build/move-scripts-around into grokys/appveyor
2 parents 31198e2 + e7b4636 commit 00becf9

File tree

85 files changed

+1658
-1303
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1658
-1303
lines changed

GitHubVS.sln

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Script", "Script", "{7B6C5F
5252
script\Require-CleanWorkTree.ps1 = script\Require-CleanWorkTree.ps1
5353
script\Run-NUnit.ps1 = script\Run-NUnit.ps1
5454
script\Run-XUnit.ps1 = script\Run-XUnit.ps1
55-
script\SolutionInfo.cs = script\SolutionInfo.cs
5655
script\Upload-DirectoryToS3.ps1 = script\Upload-DirectoryToS3.ps1
5756
EndProjectSection
5857
EndProject

ISSUE_TEMPLATE.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
Thank you for contributing! Before you submit this issue please check that you have:
2-
- [ ] Read the ["Submitting an Issue"](https://github.com/github/VisualStudio/blob/master/CONTRIBUTING.md#submitting-an-issue) section of the Contributor Guidelines
1+
Hello! Please read the contributing guidelines before submitting an issue.
32

4-
### Version of the GitHub Extension
5-
The version of the extension is at `Tools\Extensions\Installed - GitHub Extension for Visual Studio`
3+
- GitHub Extension version:
4+
- Visual Studio version:
65

7-
### Version of Visual Studio
8-
The version of VS is on the `Help\About`, on the top left, above the copyright line.
9-
10-
### What happened
11-
Tell us what went wrong
12-
13-
### Steps to reproduce
6+
__What happened__ (with steps, logs and screenshots, if possible)

script

scripts/Run-NUnit.ps1

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<#
2+
.SYNOPSIS
3+
Runs NUnit
4+
#>
5+
6+
[CmdletBinding()]
7+
Param(
8+
[Parameter(Mandatory=$true)]
9+
[ValidateNotNullOrEmpty()]
10+
[string]
11+
$project,
12+
[int]$timeoutDuration,
13+
[string]$configuration
14+
)
15+
16+
$rootDirectory = Split-Path (Split-Path $MyInvocation.MyCommand.Path)
17+
Push-Location $rootDirectory
18+
$dll = "src\$project\bin\$configuration\$project.dll"
19+
20+
$nunitDirectory = Join-Path $rootDirectory packages\NUnit.Runners.2.6.4\tools
21+
$consoleRunner = Join-Path $nunitDirectory nunit-console-x86.exe
22+
$xml = Join-Path $rootDirectory "nunit-$project.xml"
23+
$outputPath = [System.IO.Path]::GetTempFileName()
24+
25+
$args = "-noshadow", "-xml:$xml", "-framework:net-4.5", "-exclude:Timings", $dll
26+
[object[]] $output = "$consoleRunner " + ($args -join " ")
27+
28+
$process = Start-Process -PassThru -NoNewWindow -RedirectStandardOutput $outputPath $consoleRunner ($args | %{ "`"$_`"" })
29+
Wait-Process -InputObject $process -Timeout $timeoutDuration -ErrorAction SilentlyContinue
30+
if ($process.HasExited) {
31+
$output += Get-Content $outputPath
32+
$exitCode = $process.ExitCode
33+
} else {
34+
$output += "Tests timed out. Backtrace:"
35+
$output += Get-DotNetStack $process.Id
36+
$exitCode = 9999
37+
}
38+
39+
Stop-Process -InputObject $process
40+
Remove-Item $outputPath
41+
Pop-Location
42+
43+
$result = New-Object System.Object
44+
$result | Add-Member -Type NoteProperty -Name Output -Value $output
45+
$result | Add-Member -Type NoteProperty -Name ExitCode -Value $exitCode
46+
$result
47+

scripts/Run-XUnit.ps1

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<#
2+
.SYNOPSIS
3+
Runs xUnit
4+
#>
5+
6+
[CmdletBinding()]
7+
Param(
8+
[Parameter(Mandatory=$true)]
9+
[ValidateNotNullOrEmpty()]
10+
[string]
11+
$project,
12+
[int]$timeoutDuration,
13+
[string]$configuration
14+
)
15+
16+
$rootDirectory = Split-Path (Split-Path $MyInvocation.MyCommand.Path)
17+
Push-Location $rootDirectory
18+
19+
$dll = "src\$project\bin\$configuration\$project.dll"
20+
21+
$xunitDirectory = Join-Path $rootDirectory packages\xunit.runner.console.2.1.0\tools
22+
$consoleRunner = Join-Path $xunitDirectory xunit.console.x86.exe
23+
$xml = Join-Path $rootDirectory "nunit-$project.xml"
24+
$outputPath = [System.IO.Path]::GetTempFileName()
25+
26+
$args = $dll, "-noshadow", "-xml", $xml, "-parallel", "all"
27+
[object[]] $output = "$consoleRunner " + ($args -join " ")
28+
29+
$process = Start-Process -PassThru -NoNewWindow -RedirectStandardOutput $outputPath $consoleRunner ($args | %{ "`"$_`"" })
30+
Wait-Process -InputObject $process -Timeout $timeoutDuration -ErrorAction SilentlyContinue
31+
if ($process.HasExited) {
32+
$output += Get-Content $outputPath
33+
$exitCode = $process.ExitCode
34+
} else {
35+
$output += "Tests timed out. Backtrace:"
36+
$output += Get-DotNetStack $process.Id
37+
$exitCode = 9999
38+
}
39+
Stop-Process -InputObject $process
40+
Remove-Item $outputPath
41+
Pop-Location
42+
43+
$result = New-Object System.Object
44+
$result | Add-Member -Type NoteProperty -Name Output -Value $output
45+
$result | Add-Member -Type NoteProperty -Name ExitCode -Value $exitCode
46+
$result
47+

src/DesignTimeStyleHelper/DesignTimeStyleHelper.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@
120120
</Page>
121121
</ItemGroup>
122122
<ItemGroup>
123+
<Compile Include="..\common\SolutionInfo.cs">
124+
<Link>Properties\SolutionInfo.cs</Link>
125+
</Compile>
123126
<Compile Include="Properties\AssemblyInfo.cs">
124127
<SubType>Code</SubType>
125128
</Compile>
Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,8 @@
11
using System.Reflection;
2-
using System.Resources;
3-
using System.Runtime.CompilerServices;
4-
using System.Runtime.InteropServices;
52
using System.Windows;
63

7-
// General Information about an assembly is controlled through the following
8-
// set of attributes. Change these attribute values to modify the information
9-
// associated with an assembly.
104
[assembly: AssemblyTitle("DesignTimeStyleHelper")]
11-
[assembly: AssemblyDescription("")]
12-
[assembly: AssemblyConfiguration("")]
13-
[assembly: AssemblyCompany("")]
14-
[assembly: AssemblyProduct("DesignTimeStyleHelper")]
15-
[assembly: AssemblyCopyright("Copyright © 2015")]
16-
[assembly: AssemblyTrademark("")]
17-
[assembly: AssemblyCulture("")]
18-
19-
// Setting ComVisible to false makes the types in this assembly not visible
20-
// to COM components. If you need to access a type in this assembly from
21-
// COM, set the ComVisible attribute to true on that type.
22-
[assembly: ComVisible(false)]
5+
[assembly: AssemblyDescription("Helper app for UI testing")]
236

247
//In order to begin building localizable applications, set
258
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
@@ -39,17 +22,3 @@
3922
//(used if a resource is not found in the page,
4023
// app, or any theme specific resource dictionaries)
4124
)]
42-
43-
44-
// Version information for an assembly consists of the following four values:
45-
//
46-
// Major Version
47-
// Minor Version
48-
// Build Number
49-
// Revision
50-
//
51-
// You can specify all the values or you can default the Build and Revision Numbers
52-
// by using the '*' as shown below:
53-
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("1.0.0.0")]
55-
[assembly: AssemblyFileVersion("1.0.0.0")]

src/GitHub.App/Api/ApiClient.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,25 @@ public IObservable<PullRequest> GetPullRequestsForRepository(string owner, strin
232232
{
233233
return gitHubClient.PullRequest.GetAllForRepository(owner, name,
234234
new PullRequestRequest {
235-
State = ItemState.All,
235+
State = ItemStateFilter.All,
236236
SortProperty = PullRequestSort.Updated,
237237
SortDirection = SortDirection.Descending
238238
});
239239
}
240+
241+
public IObservable<PullRequest> CreatePullRequest(NewPullRequest pullRequest, string owner, string repo)
242+
{
243+
return gitHubClient.PullRequest.Create(owner, repo, pullRequest);
244+
}
245+
240246
public IObservable<Repository> GetRepositories()
241247
{
242248
return gitHubClient.Repository.GetAllForCurrent();
243249
}
250+
251+
public IObservable<Branch> GetBranches(string owner, string repo)
252+
{
253+
return gitHubClient.Repository.GetAllBranches(owner, repo);
254+
}
244255
}
245256
}

src/GitHub.App/Controllers/UIController.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ internal enum Trigger
105105
readonly IUIFactory factory;
106106
readonly IUIProvider uiProvider;
107107
readonly IRepositoryHosts hosts;
108-
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
109108
readonly IConnectionManager connectionManager;
110109

111110
readonly CompositeDisposable disposables = new CompositeDisposable();
@@ -333,7 +332,8 @@ void ConfigureUIHandlingStates()
333332
.OnEntryFrom(triggers[Trigger.PRDetail], (arg, tr) => RunView(UIViewType.PRDetail, CalculateDirection(tr), arg))
334333
.PermitDynamic(Trigger.Next, () => Go(Trigger.Next))
335334
.PermitDynamic(Trigger.Cancel, () => Go(Trigger.Cancel))
336-
.PermitDynamic(Trigger.Finish, () => Go(Trigger.Finish));
335+
.PermitDynamic(Trigger.Finish, () => Go(Trigger.Finish))
336+
.OnExit(() => DisposeView(activeFlow, UIViewType.PRDetail));
337337

338338
uiStateMachine.Configure(UIViewType.PRCreation)
339339
.OnEntry(tr => RunView(UIViewType.PRCreation, CalculateDirection(tr)))
@@ -622,6 +622,17 @@ void DisposeFlow(UIControllerFlow flow)
622622
list.Clear();
623623
}
624624

625+
void DisposeView(UIControllerFlow flow, UIViewType type)
626+
{
627+
var list = GetObjectsForFlow(flow);
628+
IUIPair uipair = null;
629+
if (list.TryGetValue(type, out uipair))
630+
{
631+
list.Remove(type);
632+
uipair.Dispose();
633+
}
634+
}
635+
625636
void RunView(UIViewType viewType, LoadDirection direction, ViewWithData arg = null)
626637
{
627638
if (requestedTarget?.ViewType == viewType)

src/GitHub.App/Extensions/AkavacheExtensions.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,37 @@ static IObservable<T> GetAndFetchLatestFromIndex<T>(this IBlobCache This,
241241
.Replay().RefCount();
242242
}
243243

244+
/// <summary>
245+
/// This method adds a new object to the database and updates the
246+
/// corresponding index.
247+
/// </summary>
248+
/// <typeparam name="T"></typeparam>
249+
/// <param name="blobCache">The cache to retrieve the object from.</param>
250+
/// <param name="key">The key to look up the cache value with.</param>
251+
/// <param name="item">The item to add to the database</param>
252+
/// <param name="maxCacheDuration">
253+
/// The maximum age of a cache object before the object is treated as
254+
/// expired and unusable. Cache objects older than this will be treated
255+
/// as a cache miss.
256+
/// <returns></returns>
257+
public static IObservable<T> PutAndUpdateIndex<T>(this IBlobCache blobCache,
258+
string key,
259+
Func<IObservable<T>> fetchFunc,
260+
TimeSpan maxCacheDuration)
261+
where T : CacheItem
262+
{
263+
return Observable.Defer(() =>
264+
{
265+
var absoluteExpiration = blobCache.Scheduler.Now + maxCacheDuration;
266+
return blobCache.GetOrCreateObject(key, () => CacheIndex.Create(key))
267+
.SelectMany(index => fetchFunc()
268+
.Catch<T, Exception>(Observable.Throw<T>)
269+
.SelectMany(x => x.Save<T>(blobCache, key, absoluteExpiration))
270+
.Do(x => index.AddAndSave(blobCache, key, x, absoluteExpiration))
271+
);
272+
});
273+
}
274+
244275
static bool IsExpired(IBlobCache blobCache, DateTimeOffset itemCreatedAt, TimeSpan cacheDuration)
245276
{
246277
var elapsed = blobCache.Scheduler.Now - itemCreatedAt.ToUniversalTime();

0 commit comments

Comments
 (0)