Skip to content

Commit

Permalink
Removed comments, clarify changes. Working out libgit2sharp v0.24
Browse files Browse the repository at this point in the history
  • Loading branch information
Nelson Vides committed Nov 21, 2017
1 parent d7fc5ef commit f651a9e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
18 changes: 1 addition & 17 deletions Rubberduck.SourceControl/GitProvider.cs
Expand Up @@ -185,7 +185,6 @@ public override IRepository InitVBAProject(string directory)
var status = repo.RetrieveStatus(new StatusOptions {DetectRenamesInWorkDir = true}); var status = repo.RetrieveStatus(new StatusOptions {DetectRenamesInWorkDir = true});
foreach (var stat in status.Untracked) foreach (var stat in status.Untracked)
{ {
// repo.Stage(stat.FilePath); //deprecated from LibGit2Sharp v0.24
LibGit2Sharp.Commands.Stage(repo, stat.FilePath); LibGit2Sharp.Commands.Stage(repo, stat.FilePath);
} }


Expand Down Expand Up @@ -247,13 +246,7 @@ public override void Fetch([Optional] string remoteName)


if (remote != null) if (remote != null)
{ {
//_repo.Network.Fetch(remote); // deprecated on LibGit2Sharp from v0.24.0 // FIXME: hardcoded string
/*
* The new functionality requires a refSpec.
* As I suppose we're just tracking by default the whole remote,
* then I choose to hardcode the refSpec here:
*/
// NOTE: hardcoded string
IEnumerable<string> refSpec = new List<string>() {"+refs/heads/*:refs/remotes/origin/*"}; IEnumerable<string> refSpec = new List<string>() {"+refs/heads/*:refs/remotes/origin/*"};
LibGit2Sharp.Commands.Fetch(_repo, remoteName, refSpec, null,""); LibGit2Sharp.Commands.Fetch(_repo, remoteName, refSpec, null,"");
} }
Expand All @@ -279,7 +272,6 @@ public override void Pull()
}; };


var signature = GetSignature(); var signature = GetSignature();
//_repo.Network.Pull(signature, options); // deprecated on LibGit2Sharp from v0.24.0
LibGit2Sharp.Commands.Pull(_repo, signature, options); LibGit2Sharp.Commands.Pull(_repo, signature, options);


base.Pull(); base.Pull();
Expand Down Expand Up @@ -311,7 +303,6 @@ public override void Stage(string filePath)
{ {
try try
{ {
// _repo.Stage(filePath); // deprecated on LibGit2Sharp from v0.24.0
LibGit2Sharp.Commands.Stage(_repo, filePath); LibGit2Sharp.Commands.Stage(_repo, filePath);
} }
catch (LibGit2SharpException ex) catch (LibGit2SharpException ex)
Expand All @@ -324,7 +315,6 @@ public override void Stage(IEnumerable<string> filePaths)
{ {
try try
{ {
//_repo.Stage(filePaths); // deprecated on LibGit2Sharp from v0.24.0
LibGit2Sharp.Commands.Stage(_repo, filePaths); LibGit2Sharp.Commands.Stage(_repo, filePaths);
} }
catch (LibGit2SharpException ex) catch (LibGit2SharpException ex)
Expand Down Expand Up @@ -360,7 +350,6 @@ public override void Checkout(string branch)
{ {
try try
{ {
//_repo.Checkout(_repo.Branches[branch]); // deprecated on LibGit2Sharp from v0.24.0
LibGit2Sharp.Commands.Checkout(_repo, branch); LibGit2Sharp.Commands.Checkout(_repo, branch);
base.Checkout(branch); base.Checkout(branch);


Expand All @@ -377,7 +366,6 @@ public override void CreateBranch(string branch)
try try
{ {
_repo.CreateBranch(branch); _repo.CreateBranch(branch);
//_repo.Checkout(branch); // deprecated on LibGit2Sharp from v0.24.0
LibGit2Sharp.Commands.Checkout(_repo,branch); LibGit2Sharp.Commands.Checkout(_repo,branch);


RequeryUnsyncedCommits(); RequeryUnsyncedCommits();
Expand All @@ -393,7 +381,6 @@ public override void CreateBranch(string sourceBranch, string branch)
try try
{ {
_repo.CreateBranch(branch, _repo.Branches[sourceBranch].Commits.Last()); _repo.CreateBranch(branch, _repo.Branches[sourceBranch].Commits.Last());
//_repo.Checkout(branch); // deprecated on LibGit2Sharp from v0.24.0
LibGit2Sharp.Commands.Checkout(_repo, branch); LibGit2Sharp.Commands.Checkout(_repo, branch);


RequeryUnsyncedCommits(); RequeryUnsyncedCommits();
Expand Down Expand Up @@ -432,7 +419,6 @@ public override void Unpublish(string branch)
{ {
try try
{ {
//var remote = _repo.Branches[branch].Remote; // deprecated on LibGit2Sharp from v0.24.0
var remote = _repo.Network.Remotes[branch]; var remote = _repo.Network.Remotes[branch];


_repo.Branches.Update(_repo.Branches[branch], b => b.Remote = remote.Name, _repo.Branches.Update(_repo.Branches[branch], b => b.Remote = remote.Name,
Expand Down Expand Up @@ -498,7 +484,6 @@ public override void RemoveFile(string filePath, bool removeFromWorkingDirectory
try try
{ {
NotifyExternalFileChanges = false; NotifyExternalFileChanges = false;
//_repo.Remove(filePath, removeFromWorkingDirectory); // deprecated on LibGit2Sharp from v0.24.0
LibGit2Sharp.Commands.Remove(_repo, filePath, removeFromWorkingDirectory); LibGit2Sharp.Commands.Remove(_repo, filePath, removeFromWorkingDirectory);
NotifyExternalFileChanges = true; NotifyExternalFileChanges = true;
} }
Expand Down Expand Up @@ -572,7 +557,6 @@ public override void DeleteBranch(string branchName)
}; };
} }


//_repo.Network.Push(branch.Remote, ":" + _repo.Branches[branchName].UpstreamBranchCanonicalName, options); // deprecated on LibGit2Sharp from v0.24.0
_repo.Network.Push(_repo.Network.Remotes[branchName], ":" + _repo.Branches[branchName].UpstreamBranchCanonicalName, options); _repo.Network.Push(_repo.Network.Remotes[branchName], ":" + _repo.Branches[branchName].UpstreamBranchCanonicalName, options);
} }


Expand Down
3 changes: 1 addition & 2 deletions Rubberduck.SourceControl/Rubberduck.SourceControl.csproj
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\LibGit2Sharp.0.22.0-pre20150516171636\build\net40\LibGit2Sharp.props" Condition="Exists('..\packages\LibGit2Sharp.0.22.0-pre20150516171636\build\net40\LibGit2Sharp.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -40,6 +39,7 @@
<ItemGroup> <ItemGroup>
<Reference Include="LibGit2Sharp, Version=0.24.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333, processorArchitecture=MSIL"> <Reference Include="LibGit2Sharp, Version=0.24.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<private>True</private>
<HintPath>..\packages\LibGit2Sharp.0.24.0\lib\net40\LibGit2Sharp.dll</HintPath> <HintPath>..\packages\LibGit2Sharp.0.24.0\lib\net40\LibGit2Sharp.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.Vbe.Interop, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"> <Reference Include="Microsoft.Vbe.Interop, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
Expand Down Expand Up @@ -108,7 +108,6 @@
<PropertyGroup> <PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup> </PropertyGroup>
<Error Condition="!Exists('..\packages\LibGit2Sharp.0.22.0-pre20150516171636\build\net40\LibGit2Sharp.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LibGit2Sharp.0.22.0-pre20150516171636\build\net40\LibGit2Sharp.props'))" />
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" /> <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target> </Target>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" /> <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
Expand Down

0 comments on commit f651a9e

Please sign in to comment.