Browse Source

升级 LibGit2Sharp,远程拉取测试通过

master
大石头 6 years ago
parent
commit
d2dfd02032
  1. 1
      .gitignore
  2. 8
      GitCandy.Web/Git/GitService.cs
  3. 46
      GitCandy.Web/GitCandy.Web.csproj
  4. 86
      GitCandy.Web/Web.config
  5. 22
      GitCandy.Web/packages.config
  6. 13
      GitCandy.sln
  7. 24
      GitCandy/Configuration/UserConfiguration.cs
  8. 6
      Test/App.config
  9. 48
      Test/Program.cs
  10. 36
      Test/Properties/AssemblyInfo.cs
  11. 63
      Test/Test.csproj

1
.gitignore

@ -241,3 +241,4 @@ Information
/GitCandy.Web/Content/Site.css
/DLL
/GitCandy.Web/Content/images/logo
/BinTest

8
GitCandy.Web/Git/GitService.cs

@ -391,6 +391,11 @@ namespace GitCandy.Git
public String GetArchiveFilename(String path, out String referenceName)
{
referenceName = null;
var cfg = UserConfiguration.Current;
if (!cfg.AllowArchive) return null;
var commit = GetCommitByPath(ref path, out referenceName);
if (commit == null) return null;
@ -696,7 +701,8 @@ namespace GitCandy.Git
var sw = Stopwatch.StartNew();
using (var fetch_repo = new Repository(repo.Info.Path))
{
fetch_repo.Fetch("origin");
//fetch_repo.Fetch("origin");
fetch_repo.Network.Fetch("origin", Array.Empty<String>());
}
sw.Stop();
XTrace.WriteLine("远程拉取成功,耗时 {0:n0}毫秒", sw.ElapsedMilliseconds);

46
GitCandy.Web/GitCandy.Web.csproj

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\LibGit2Sharp.NativeBinaries.1.0.129\build\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.129\build\LibGit2Sharp.NativeBinaries.props')" />
<Import Project="..\packages\LibGit2Sharp.NativeBinaries.2.0.289\build\net46\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\packages\LibGit2Sharp.NativeBinaries.2.0.289\build\net46\LibGit2Sharp.NativeBinaries.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -12,7 +12,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GitCandy.Web</RootNamespace>
<AssemblyName>GitCandy.Web</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
@ -20,6 +20,9 @@
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<Use64BitIISExpress />
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -39,9 +42,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="LibGit2Sharp, Version=0.22.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333, processorArchitecture=MSIL">
<HintPath>..\packages\LibGit2Sharp.0.22.0\lib\net40\LibGit2Sharp.dll</HintPath>
<Private>True</Private>
<Reference Include="LibGit2Sharp, Version=0.26.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333, processorArchitecture=MSIL">
<HintPath>..\packages\LibGit2Sharp.0.26.1\lib\net46\LibGit2Sharp.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualBasic" />
@ -50,7 +52,7 @@
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="NewLife.Core, Version=8.4.7252.1562, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\NewLife.Core.8.4.2019.1109\lib\net45\NewLife.Core.dll</HintPath>
<HintPath>..\packages\NewLife.Core.8.4.2019.1109\lib\net46\NewLife.Core.dll</HintPath>
</Reference>
<Reference Include="NewLife.Cube, Version=2.9.7253.33253, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\NewLife.Cube.2.9.7253.33253\lib\net45\NewLife.Cube.dll</HintPath>
@ -58,8 +60,8 @@
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Management" />
@ -68,27 +70,31 @@
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Transactions" />
<Reference Include="System.Web" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.6\lib\net45\System.Web.Helpers.dll</HintPath>
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.Mvc, Version=5.2.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.6\lib\net45\System.Web.Mvc.dll</HintPath>
<Reference Include="System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.7\lib\net45\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.6\lib\net45\System.Web.Razor.dll</HintPath>
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.7\lib\net45\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.6\lib\net45\System.Web.WebPages.dll</HintPath>
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.6\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.6\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="XCode, Version=9.14.7252.1601, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\NewLife.XCode.9.14.2019.1109\lib\net45\XCode.dll</HintPath>
</Reference>
@ -663,12 +669,6 @@
<PreBuildEvent>
</PreBuildEvent>
</PropertyGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.129\build\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LibGit2Sharp.NativeBinaries.1.0.129\build\LibGit2Sharp.NativeBinaries.props'))" />
</Target>
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
@ -687,6 +687,12 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\LibGit2Sharp.NativeBinaries.2.0.289\build\net46\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LibGit2Sharp.NativeBinaries.2.0.289\build\net46\LibGit2Sharp.NativeBinaries.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

86
GitCandy.Web/Web.config

@ -5,57 +5,69 @@
-->
<configuration>
<connectionStrings>
<add name="GitCandy" connectionString="Data Source=..\Data\GitCandy.db;" providerName="System.Data.SQLite"/>
<add name="GitCandy" connectionString="Data Source=..\Data\GitCandy.db;" providerName="System.Data.SQLite" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="3.0.0.0"/>
<add key="webpages:Enabled" value="false"/>
<add key="RouteDebugger:Enabled" value="false"/>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="RouteDebugger:Enabled" value="false" />
</appSettings>
<!--
有关 web.config 更改的说明,请参见 http://go.microsoft.com/fwlink/?LinkId=235367。
可在 <httpRuntime> 标记上设置以下特性。
<system.Web>
<httpRuntime targetFramework="4.6" />
</system.Web>
-->
<system.web>
<customErrors mode="Off"/>
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5" maxRequestLength="4194304" requestPathInvalidCharacters="" executionTimeout="1800"/>
<customErrors mode="Off" />
<compilation debug="true" targetFramework="4.6" />
<httpRuntime targetFramework="4.5" maxRequestLength="4194304" requestPathInvalidCharacters="" executionTimeout="1800" />
<pages>
<namespaces>
<add namespace="System.Web.Helpers"/>
<add namespace="System.Web.Mvc"/>
<add namespace="System.Web.Mvc.Ajax"/>
<add namespace="System.Web.Mvc.Html"/>
<add namespace="System.Web.Routing"/>
<add namespace="System.Web.WebPages"/>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
</system.web>
<system.webServer>
<!--<modules runAllManagedModulesForAllRequests="true">
--><!--全局错误处理模块--><!--
-->
<!--全局错误处理模块-->
<!--
<add name="ErrorModule" type="NewLife.Web.ErrorModule,NewLife.Core" />
--><!--页面执行时间模块,用于在页面中输出页面执行时间和查询执行次数--><!--
-->
<!--页面执行时间模块,用于在页面中输出页面执行时间和查询执行次数-->
<!--
<add name="DbRunTimeModule" type="NewLife.Cube.DbRunTimeModule,NewLife.Cube"/>
</modules>-->
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By"/>
<add name="X-Powered-By" value="NewLife.Cube http://www.NewLifeX.com"/>
<remove name="X-Powered-By" />
<add name="X-Powered-By" value="NewLife.Cube http://www.NewLifeX.com" />
</customHeaders>
</httpProtocol>
<!--静态缓存使用浏览器缓存,超时时间之内不发出Http请求(F5除外)-->
<staticContent>
<remove fileExtension=".woff"/>
<remove fileExtension=".woff2"/>
<mimeMap fileExtension=".woff" mimeType="application/x-font-woff"/>
<mimeMap fileExtension=".woff2" mimeType="application/x-font-woff"/>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="240:00:00"/>
<remove fileExtension=".woff" />
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/x-font-woff" />
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="240:00:00" />
</staticContent>
<security>
<requestFiltering allowDoubleEscaping="true">
<requestLimits maxAllowedContentLength="134217728"/>
<requestLimits maxAllowedContentLength="134217728" />
<fileExtensions allowUnlisted="true">
<clear/>
<clear />
</fileExtensions>
<hiddenSegments>
<clear/>
<clear />
</hiddenSegments>
</requestFiltering>
</security>
@ -63,28 +75,28 @@
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0"/>
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930"/>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2"/>
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-5.2.6.0" newVersion="5.2.6.0"/>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

22
GitCandy.Web/packages.config

@ -2,16 +2,16 @@
<packages>
<package id="bootstrap" version="3.3.7" targetFramework="net45" />
<package id="jQuery" version="2.0.3" targetFramework="net45" />
<package id="LibGit2Sharp" version="0.22.0" targetFramework="net45" />
<package id="LibGit2Sharp.NativeBinaries" version="1.0.129" targetFramework="net45" />
<package id="Microsoft.AspNet.Mvc" version="5.2.6" targetFramework="net45" />
<package id="Microsoft.AspNet.Mvc.zh-Hans" version="5.2.6" targetFramework="net45" />
<package id="Microsoft.AspNet.Razor" version="3.2.6" targetFramework="net45" />
<package id="Microsoft.AspNet.Razor.zh-Hans" version="3.2.6" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages" version="3.2.6" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages.zh-Hans" version="3.2.6" targetFramework="net45" />
<package id="LibGit2Sharp" version="0.26.1" targetFramework="net46" />
<package id="LibGit2Sharp.NativeBinaries" version="2.0.289" targetFramework="net46" />
<package id="Microsoft.AspNet.Mvc" version="5.2.7" targetFramework="net46" />
<package id="Microsoft.AspNet.Mvc.zh-Hans" version="5.2.7" targetFramework="net46" />
<package id="Microsoft.AspNet.Razor" version="3.2.7" targetFramework="net46" />
<package id="Microsoft.AspNet.Razor.zh-Hans" version="3.2.7" targetFramework="net46" />
<package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net46" />
<package id="Microsoft.AspNet.WebPages.zh-Hans" version="3.2.7" targetFramework="net46" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
<package id="NewLife.Core" version="8.4.2019.1109" targetFramework="net45" />
<package id="NewLife.Cube" version="2.9.7253.33253" targetFramework="net45" />
<package id="NewLife.XCode" version="9.14.2019.1109" targetFramework="net45" />
<package id="NewLife.Core" version="8.4.2019.1109" targetFramework="net46" />
<package id="NewLife.Cube" version="2.9.7253.33253" targetFramework="net46" />
<package id="NewLife.XCode" version="9.14.2019.1109" targetFramework="net46" />
</packages>

13
GitCandy.sln

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.16
# Visual Studio Version 16
VisualStudioVersion = 16.0.29503.13
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitCandy", "GitCandy\GitCandy.csproj", "{8C65D667-BA60-4810-927A-F8AFB55D55FE}"
EndProject
@ -13,6 +13,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Others", "Others", "{B011AA
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{F435002A-02CC-4A6B-85AA-994037667505}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -27,8 +29,15 @@ Global
{D1E514B2-2A79-4101-BB0D-FF2139FFD1EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D1E514B2-2A79-4101-BB0D-FF2139FFD1EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D1E514B2-2A79-4101-BB0D-FF2139FFD1EC}.Release|Any CPU.Build.0 = Release|Any CPU
{F435002A-02CC-4A6B-85AA-994037667505}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F435002A-02CC-4A6B-85AA-994037667505}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F435002A-02CC-4A6B-85AA-994037667505}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F435002A-02CC-4A6B-85AA-994037667505}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6862CE57-4211-4015-8972-D039F7C98AA6}
EndGlobalSection
EndGlobal

24
GitCandy/Configuration/UserConfiguration.cs

@ -67,12 +67,26 @@ namespace GitCandy.Configuration
[DisplayName("显示参与者数")]
public Int32 Contributors { get; set; } = 50;
//public List<HostKey> HostKeys { get; set; } = new List<HostKey>();
#endregion
/// <summary>允许打包。默认true</summary>
[DisplayName("允许打包。默认true")]
public Boolean AllowArchive { get; set; } = true;
/// <summary>允许打包。默认true</summary>
[DisplayName("允许打包。默认true")]
public Boolean AllowBlame { get; set; } = true;
/// <summary>允许打包。默认true</summary>
[DisplayName("允许打包。默认true")]
public Boolean AllowCommits { get; set; } = true;
//public UserConfiguration()
//{
//}
/// <summary>允许打包。默认true</summary>
[DisplayName("允许打包。默认true")]
public Boolean AllowContributors { get; set; } = true;
/// <summary>允许打包。默认true</summary>
[DisplayName("允许打包。默认true")]
public Boolean AllowHistoryDivergence { get; set; } = true;
#endregion
protected override void OnNew()
{

6
Test/App.config

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
</configuration>

48
Test/Program.cs

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.IO;
using LibGit2Sharp;
using NewLife.Log;
namespace Test
{
class Program
{
static void Main(String[] args)
{
XTrace.UseConsole();
try
{
Test1();
}
catch (Exception ex)
{
XTrace.WriteException(ex);
}
Console.WriteLine("OK");
Console.ReadLine();
}
static void Test1()
{
//var remoteUrl = "https://gitee.com/NewLifeX/NewLife.Cube";
var remoteUrl = "https://gitee.com/NewLifeX/GitCandy";
var xx = "xx".GetFullPath();
//if (Directory.Exists(xx)) Directory.Delete(xx, true);
var p = xx;
if (!Directory.Exists(xx)) p = Repository.Init(xx, true);
using (var repo = new Repository(p))
{
repo.Network.Remotes.Add("origin", remoteUrl, "+refs/*:refs/*");
//var refs = repo.Network.ListReferences("origin").ToList();
//XTrace.WriteLine("发现分支:{0}", refs.Select(e => e.TargetIdentifier));
//repo.Network.Fetch("origin", new[] { "master" });
repo.Network.Fetch("origin", new string[0]);
}
}
}
}

36
Test/Properties/AssemblyInfo.cs

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Test")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("f435002a-02cc-4a6b-85aa-994037667505")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

63
Test/Test.csproj

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F435002A-02CC-4A6B-85AA-994037667505}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Test</RootNamespace>
<AssemblyName>Test</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\BinTest\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\BinTest\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="LibGit2Sharp">
<Version>0.26.1</Version>
</PackageReference>
<PackageReference Include="NewLife.Core">
<Version>8.4.2019.1109</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Loading…
Cancel
Save