Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
560 changes: 0 additions & 560 deletions src/.paket/Paket.Restore.targets

This file was deleted.

Binary file removed src/.paket/paket.exe
Binary file not shown.
72 changes: 0 additions & 72 deletions src/.paket/paket.targets

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System.Text.RegularExpressions;
using System.Text.RegularExpressions;
using NDesk.Options;
using GitTfs.Util;

namespace GitTfs.Commands
{
[StructureMapSingleton]
public class CheckinOptions
{
public OptionSet OptionSet => new OptionSet
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using GitTfs.Util;
using NDesk.Options;

namespace GitTfs.Commands
{
[StructureMapSingleton]
public class RemoteOptions
{
public OptionSet OptionSet => new OptionSet
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using GitTfs.Commands; // ToGitRefName() and RemoteOptions
using GitTfs.Commands; // RemoteOptions
using GitTfs.Util; // ToGitRefName()
using System.Diagnostics;

namespace GitTfs.Core
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
using GitTfs.Util;

using System.Diagnostics;

namespace GitTfs.Core
{
[StructureMapSingleton]
public class Janitor : IDisposable
{
private readonly Queue<Action> _actions = new Queue<Action>();
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions src/GitTfs.Core/GitTfs.Core.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<Compile Include="..\CommonAssemblyInfo.cs">
<Link>Properties\CommonAssemblyInfo.cs</Link>
</Compile>
<None Include="Core\TfsInterop\README.txt" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="LibGit2Sharp" Version="0.31.0" />
<PackageReference Include="StructureMap" Version="4.7.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NDesk.Options\NDesk.Options.csproj" />
</ItemGroup>
</Project>
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions src/GitTfs/Globals.cs → src/GitTfs.Core/Globals.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using System.Diagnostics;
using NDesk.Options;
using GitTfs.Core;
using GitTfs.Util;

namespace GitTfs
{
[StructureMapSingleton]
public class Globals
{
public OptionSet OptionSet => new OptionSet
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Text.RegularExpressions;
using System.Text.RegularExpressions;
using GitTfs.Core;
using System.Diagnostics;

Expand Down Expand Up @@ -35,7 +35,7 @@ public Author(string tfsUserId, string name, string email)
#endregion
}

[StructureMapSingleton]

public class AuthorsFile
{
private readonly Dictionary<string, Author> _authorsByTfsUserId = new Dictionary<string, Author>(StringComparer.OrdinalIgnoreCase);
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
namespace GitTfs.Util
{
// Manages configurable values.
[StructureMapSingleton]
public class ConfigPropertyLoader
{
private readonly Globals _globals;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections;
using System.Collections;
using System.Text.RegularExpressions;

namespace GitTfs.Extensions
namespace GitTfs.Util
{
public static class InspectExtensions
{
Expand Down
File renamed without changes.
76 changes: 76 additions & 0 deletions src/GitTfs.Core/Util/StringExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@

using System.Text.RegularExpressions;

using GitTfs.Core;

namespace GitTfs.Util
{
public static class StringExtensions
{
private static readonly Regex ValidTfsPath = new Regex("^\\$/.+");
public static bool IsValidTfsPath(this string tfsPath) => ValidTfsPath.IsMatch(tfsPath);

public static void AssertValidTfsPathOrRoot(this string tfsPath)
{
if (tfsPath == GitTfsConstants.TfsRoot)
return;
AssertValidTfsPath(tfsPath);
}

public static void AssertValidTfsPath(this string tfsPath)
{
if (!ValidTfsPath.IsMatch(tfsPath))
throw new GitTfsException("TFS repository can not be root and must start with \"$/\".", SuggestPaths(tfsPath));
}

private static IEnumerable<string> SuggestPaths(string tfsPath)
{
if (tfsPath == "$" || tfsPath == "$/")
yield return "Cloning an entire TFS repository is not supported. Try using a subdirectory of the root (e.g. $/MyProject).";
else if (tfsPath.StartsWith("$"))
yield return "Try using $/" + tfsPath.Substring(1);
else
yield return "Try using $/" + tfsPath;
}

public static string ToGitRefName(this string expectedRefName)
{
expectedRefName = Regex.Replace(expectedRefName, @"[!~$?[*^: \\]", string.Empty);
expectedRefName = expectedRefName.Replace("@{", string.Empty);
expectedRefName = expectedRefName.Replace("..", string.Empty);
expectedRefName = expectedRefName.Replace("//", string.Empty);
expectedRefName = expectedRefName.Replace("/.", "/");
expectedRefName = expectedRefName.TrimEnd('.', '/');
return expectedRefName.Trim('/');
}

public static string ToGitBranchNameFromTfsRepositoryPath(this string tfsRepositoryPath, bool includeTeamProjectName = false)
{
if (includeTeamProjectName)
{
return tfsRepositoryPath
.Replace("$/", string.Empty)
.ToGitRefName();
}

string gitBranchNameExpected = tfsRepositoryPath.IndexOf("$/") == 0
? tfsRepositoryPath.Remove(0, tfsRepositoryPath.IndexOf('/', 2) + 1)
: tfsRepositoryPath;

return gitBranchNameExpected.ToGitRefName();
}

public static string ToTfsTeamProjectRepositoryPath(this string tfsRepositoryPath)
{
if (!tfsRepositoryPath.StartsWith("$/"))
{
return tfsRepositoryPath;
}

var index = tfsRepositoryPath.IndexOf('/', 2);
return index == -1 ? tfsRepositoryPath : tfsRepositoryPath.Remove(index, tfsRepositoryPath.Length - index);
}

public static string ToLocalGitRef(this string refName) => "refs/heads/" + refName;
}
}
File renamed without changes.
File renamed without changes.
7 changes: 4 additions & 3 deletions src/GitTfs.Vs2019/GitTfs.Vs2019.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GitTfs\GitTfs.csproj" />
<ProjectReference Include="..\GitTfs.Core\GitTfs.Core.csproj" />
</ItemGroup>
<ItemGroup>
<None Include="paket.references" />
<PackageReference Include="Microsoft.TeamFoundationServer.ExtendedClient" Version="20.256.2" />
<PackageReference Include="Microsoft.VisualStudio.Settings.15.0" Version="17.10.34916.79" />
<PackageReference Include="Microsoft.VisualStudio.Setup.Configuration.Interop" Version="3.14.2075" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Windows.Forms" />
Expand All @@ -37,5 +39,4 @@
<Exec Command="xcopy /y /I &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)GitTfs\$(OutDir)$(ProjectName)&quot; /EXCLUDE:..\build\files_to_ignore_during_post_build_copy.txt" />
<Exec Command="xcopy /y /I &quot;$(TargetDir)*.pdb&quot; &quot;$(SolutionDir)GitTfs\$(OutDir)$(ProjectName)&quot; /EXCLUDE:..\build\files_to_ignore_during_post_build_copy.txt" />
</Target>
<Import Project="..\.paket\Paket.Restore.targets" />
</Project>
7 changes: 0 additions & 7 deletions src/GitTfs.Vs2019/paket.references

This file was deleted.

11 changes: 6 additions & 5 deletions src/GitTfs.Vs2022/GitTfs.Vs2022.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@
<Link>Wrappers.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GitTfs.Core\GitTfs.Core.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GitTfs\GitTfs.csproj" />
</ItemGroup>
<ItemGroup>
<None Include="paket.references" />
<PackageReference Include="Microsoft.TeamFoundationServer.ExtendedClient" Version="20.256.2" />
<PackageReference Include="Microsoft.VisualStudio.Settings.15.0" Version="17.10.34916.79" />
<PackageReference Include="Microsoft.VisualStudio.Setup.Configuration.Interop" Version="3.14.2075" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Windows.Forms" />
Expand All @@ -37,5 +39,4 @@
<Exec Command="xcopy /y /I &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)GitTfs\$(OutDir)$(ProjectName)&quot; /EXCLUDE:..\build\files_to_ignore_during_post_build_copy.txt" />
<Exec Command="xcopy /y /I &quot;$(TargetDir)*.pdb&quot; &quot;$(SolutionDir)GitTfs\$(OutDir)$(ProjectName)&quot; /EXCLUDE:..\build\files_to_ignore_during_post_build_copy.txt" />
</Target>
<Import Project="..\.paket\Paket.Restore.targets" />
</Project>
7 changes: 0 additions & 7 deletions src/GitTfs.Vs2022/paket.references

This file was deleted.

3 changes: 1 addition & 2 deletions src/GitTfs.VsCommon/TfsHelper.Common.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Diagnostics;
using System.Diagnostics;
using System.Net;
using System.Reflection;
using Microsoft.TeamFoundation.Client;
Expand All @@ -8,7 +8,6 @@
using GitTfs.Commands;
using GitTfs.Core;
using GitTfs.Core.TfsInterop;
using GitTfs.Extensions;
using GitTfs.Util;
using StructureMap;
using StructureMap.Attributes;
Expand Down
3 changes: 1 addition & 2 deletions src/GitTfs.VsFake/GitTfs.VsFake.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GitTfs\GitTfs.csproj" />
<ProjectReference Include="..\GitTfs.Core\GitTfs.Core.csproj" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="xcopy /y /I &quot;$(TargetPath)&quot; &quot;$(SolutionDir)GitTfs\$(OutDir)*&quot;" />
</Target>
<Import Project="..\.paket\Paket.Restore.targets" />
</Project>
1 change: 0 additions & 1 deletion src/GitTfs.VsFake/paket.references

This file was deleted.

Loading