Browse files

All newlines are unix (in the repo).

  • Loading branch information...
1 parent 67908e9 commit c96eca911b2db08c8fac8e19296ba6714f2c599e @spraints spraints committed Jan 27, 2011
Showing with 2,169 additions and 2,169 deletions.
  1. +147 −147 GitTfs.Vs2008/GitTfs.Vs2008.csproj
  2. +11 −11 GitTfs.Vs2008/TfsHelper.Vs2008.cs
  3. +139 −139 GitTfs.Vs2010/GitTfs.Vs2010.csproj
  4. +27 −27 GitTfs.Vs2010/ParentForm.cs
  5. +91 −91 GitTfs.Vs2010/TfsHelper.Vs2010.cs
  6. +94 −94 GitTfs.VsCommon/TfsHelper.Common.cs
  7. +8 −8 GitTfs.VsCommon/Wrappers.cs
  8. +62 −62 GitTfs.sln
  9. +10 −10 GitTfs.vsmdi
  10. +24 −24 GitTfs/Commands/CheckinTool.cs
  11. +11 −11 GitTfs/Commands/Clone.cs
  12. +79 −79 GitTfs/Commands/Fetch.cs
  13. +64 −64 GitTfs/Commands/Help.cs
  14. +14 −14 GitTfs/Commands/QuickClone.cs
  15. +16 −16 GitTfs/Commands/QuickFetch.cs
  16. +8 −8 GitTfs/Core/GitRepository.cs
  17. +403 −403 GitTfs/Core/GitTfsRemote.cs
  18. +33 −33 GitTfs/Core/IGitTfsRemote.cs
  19. +9 −9 GitTfs/Core/ITfsChangeset.cs
  20. +2 −2 GitTfs/Core/ITfsWorkspace.cs
  21. +13 −13 GitTfs/Core/TfsChangeset.cs
  22. +1 −1 GitTfs/Core/TfsInterop/IChangeset.cs
  23. +9 −9 GitTfs/Core/TfsInterop/ITfsHelper.cs
  24. +13 −13 GitTfs/Core/TfsInterop/IVersionControlServer.cs
  25. +6 −6 GitTfs/Core/TfsInterop/IWorkItemCheckedInfo.cs
  26. +9 −9 GitTfs/Core/TfsInterop/TfsRecursionType.cs
  27. +157 −157 GitTfs/Core/TfsWorkspace.cs
  28. +22 −22 GitTfs/GitTfs.cs
  29. +213 −213 GitTfs/GitTfs.csproj
  30. +61 −61 GitTfs/Util/GitTfsCommandFactory.cs
  31. +15 −15 GitTfs/Util/PluggableWithAliases.cs
  32. +109 −109 GitTfsBenchmarks/GitTfsBenchmarks.csproj
  33. +114 −114 GitTfsTest.Vs2010/GitTfsTest.Vs2010.csproj
  34. +3 −3 GitTfsTest/Commands/ShelveTest.cs
  35. +133 −133 GitTfsTest/GitTfsTest.csproj
  36. +4 −4 LocalTestRun.testrunconfig
  37. +35 −35 README
View
294 GitTfs.Vs2008/GitTfs.Vs2008.csproj
@@ -1,148 +1,148 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.30729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{09BF8124-19A8-45BE-896B-536CA0F3F0FC}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Sep.Git.Tfs.Vs2008</RootNamespace>
- <AssemblyName>GitTfs.Vs2008</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <OldToolsVersion>3.5</OldToolsVersion>
- <UpgradeBackupLocation />
- <PublishUrl>publish\</PublishUrl>
- <Install>true</Install>
- <InstallFrom>Disk</InstallFrom>
- <UpdateEnabled>false</UpdateEnabled>
- <UpdateMode>Foreground</UpdateMode>
- <UpdateInterval>7</UpdateInterval>
- <UpdateIntervalUnits>Days</UpdateIntervalUnits>
- <UpdatePeriodically>false</UpdatePeriodically>
- <UpdateRequired>false</UpdateRequired>
- <MapFileExtensions>true</MapFileExtensions>
- <ApplicationRevision>0</ApplicationRevision>
- <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
- <IsWebBootstrapper>false</IsWebBootstrapper>
- <UseApplicationTrust>false</UseApplicationTrust>
- <BootstrapperEnabled>true</BootstrapperEnabled>
- <TargetFrameworkProfile />
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
- <DebugSymbols>true</DebugSymbols>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <DebugType>full</DebugType>
- <PlatformTarget>x86</PlatformTarget>
- <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
- <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <Optimize>true</Optimize>
- <DebugType>pdbonly</DebugType>
- <PlatformTarget>x86</PlatformTarget>
- <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
- <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="Microsoft.TeamFoundation, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86">
- <HintPath>C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.TeamFoundation.Client, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86">
- <HintPath>C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.Client.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.TeamFoundation.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86">
- <HintPath>C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.Common.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.TeamFoundation.Common.Library, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86">
- <HintPath>C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.Common.Library.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.TeamFoundation.VersionControl.Client, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86">
- <HintPath>C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.VersionControl.Client.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.TeamFoundation.WorkItemTracking.Client, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86">
- <HintPath>C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.WorkItemTracking.Client.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Core">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Xml.Linq">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data.DataSetExtensions">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- <Reference Include="StructureMap, Version=2.5.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\lib\StructureMap\StructureMap.dll</HintPath>
- </Reference>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="..\CommonAssemblyInfo.cs">
- <Link>Properties\CommonAssemblyInfo.cs</Link>
- </Compile>
- <Compile Include="..\GitTfs.VsCommon\TfsApiBridge.cs">
- <Link>TfsApiBridge.cs</Link>
- </Compile>
- <Compile Include="..\GitTfs.VsCommon\TfsHelper.Common.cs">
- <Link>TfsHelper.Common.cs</Link>
- </Compile>
- <Compile Include="..\GitTfs.VsCommon\Wrappers.cs">
- <Link>Wrappers.cs</Link>
- </Compile>
- <Compile Include="..\Version.cs">
- <Link>Properties\Version.cs</Link>
- </Compile>
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="TfsHelper.Vs2008.cs" />
- <Compile Include="TfsPlugin.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\GitTfs\GitTfs.csproj">
- <Project>{55C169E0-93CC-488C-9885-1D4EAF4EA236}</Project>
- <Name>GitTfs</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
- <Install>false</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
- <Visible>False</Visible>
- <ProductName>Windows Installer 3.1</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- 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">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
- <PropertyGroup>
- <PostBuildEvent>xcopy /y "$(TargetDir)*.dll" "$(SolutionDir)GitTfs\$(OutDir)"</PostBuildEvent>
- </PropertyGroup>
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{09BF8124-19A8-45BE-896B-536CA0F3F0FC}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Sep.Git.Tfs.Vs2008</RootNamespace>
+ <AssemblyName>GitTfs.Vs2008</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>3.5</OldToolsVersion>
+ <UpgradeBackupLocation />
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ <TargetFrameworkProfile />
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+ <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+ <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Microsoft.TeamFoundation, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86">
+ <HintPath>C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.TeamFoundation.Client, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86">
+ <HintPath>C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.Client.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.TeamFoundation.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86">
+ <HintPath>C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.Common.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.TeamFoundation.Common.Library, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86">
+ <HintPath>C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.Common.Library.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.TeamFoundation.VersionControl.Client, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86">
+ <HintPath>C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.VersionControl.Client.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.TeamFoundation.WorkItemTracking.Client, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86">
+ <HintPath>C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.WorkItemTracking.Client.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Xml.Linq">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data.DataSetExtensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ <Reference Include="StructureMap, Version=2.5.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\lib\StructureMap\StructureMap.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\CommonAssemblyInfo.cs">
+ <Link>Properties\CommonAssemblyInfo.cs</Link>
+ </Compile>
+ <Compile Include="..\GitTfs.VsCommon\TfsApiBridge.cs">
+ <Link>TfsApiBridge.cs</Link>
+ </Compile>
+ <Compile Include="..\GitTfs.VsCommon\TfsHelper.Common.cs">
+ <Link>TfsHelper.Common.cs</Link>
+ </Compile>
+ <Compile Include="..\GitTfs.VsCommon\Wrappers.cs">
+ <Link>Wrappers.cs</Link>
+ </Compile>
+ <Compile Include="..\Version.cs">
+ <Link>Properties\Version.cs</Link>
+ </Compile>
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="TfsHelper.Vs2008.cs" />
+ <Compile Include="TfsPlugin.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\GitTfs\GitTfs.csproj">
+ <Project>{55C169E0-93CC-488C-9885-1D4EAF4EA236}</Project>
+ <Name>GitTfs</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+ <Visible>False</Visible>
+ <ProductName>Windows Installer 3.1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- 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">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+ <PropertyGroup>
+ <PostBuildEvent>xcopy /y "$(TargetDir)*.dll" "$(SolutionDir)GitTfs\$(OutDir)"</PostBuildEvent>
+ </PropertyGroup>
</Project>
View
22 GitTfs.Vs2008/TfsHelper.Vs2008.cs
@@ -1,5 +1,5 @@
-using System;
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using Microsoft.TeamFoundation.Client;
using Sep.Git.Tfs.Core.TfsInterop;
@@ -12,15 +12,15 @@ public partial class TfsHelper : ITfsHelper
public string TfsClientLibraryVersion
{
get { return typeof(TeamFoundationServer).Assembly.GetName().Version.ToString() + " (MS)"; }
- }
-
- public bool CanShowCheckinDialog { get { return false; } }
-
- public long ShowCheckinDialog(IWorkspace workspace, IPendingChange[] pendingChanges, IEnumerable<IWorkItemCheckedInfo> checkedInfos, string checkinComment)
- {
- throw new NotImplementedException();
- }
-
+ }
+
+ public bool CanShowCheckinDialog { get { return false; } }
+
+ public long ShowCheckinDialog(IWorkspace workspace, IPendingChange[] pendingChanges, IEnumerable<IWorkItemCheckedInfo> checkedInfos, string checkinComment)
+ {
+ throw new NotImplementedException();
+ }
+
private void UpdateServer()
{
if (string.IsNullOrEmpty(Url))
View
278 GitTfs.Vs2010/GitTfs.Vs2010.csproj
@@ -1,140 +1,140 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.30729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{C5A374D3-A2E1-407C-9D6D-541FDB53BD62}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Sep.Git.Tfs.Vs2010</RootNamespace>
- <AssemblyName>GitTfs.Vs2010</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <OldToolsVersion>3.5</OldToolsVersion>
- <UpgradeBackupLocation />
- <PublishUrl>publish\</PublishUrl>
- <Install>true</Install>
- <InstallFrom>Disk</InstallFrom>
- <UpdateEnabled>false</UpdateEnabled>
- <UpdateMode>Foreground</UpdateMode>
- <UpdateInterval>7</UpdateInterval>
- <UpdateIntervalUnits>Days</UpdateIntervalUnits>
- <UpdatePeriodically>false</UpdatePeriodically>
- <UpdateRequired>false</UpdateRequired>
- <MapFileExtensions>true</MapFileExtensions>
- <ApplicationRevision>0</ApplicationRevision>
- <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
- <IsWebBootstrapper>false</IsWebBootstrapper>
- <UseApplicationTrust>false</UseApplicationTrust>
- <BootstrapperEnabled>true</BootstrapperEnabled>
- <TargetFrameworkProfile />
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <PlatformTarget>x86</PlatformTarget>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <PlatformTarget>x86</PlatformTarget>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="Microsoft.TeamFoundation, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
- <Reference Include="Microsoft.TeamFoundation.Client, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
- <Reference Include="Microsoft.TeamFoundation.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
- <Reference Include="Microsoft.TeamFoundation.Common.Library, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
- <Reference Include="Microsoft.TeamFoundation.VersionControl.Client, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
- <Reference Include="Microsoft.TeamFoundation.WorkItemTracking.Client, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
- <Reference Include="StructureMap, Version=2.5.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\lib\StructureMap\StructureMap.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Core">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Windows.Forms" />
- <Reference Include="System.Xml.Linq">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data.DataSetExtensions">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="..\CommonAssemblyInfo.cs">
- <Link>Properties\CommonAssemblyInfo.cs</Link>
- </Compile>
- <Compile Include="..\GitTfs.VsCommon\TfsApiBridge.cs">
- <Link>TfsApiBridge.cs</Link>
- </Compile>
- <Compile Include="..\GitTfs.VsCommon\TfsHelper.Common.cs">
- <Link>TfsHelper.Common.cs</Link>
- </Compile>
- <Compile Include="..\GitTfs.VsCommon\Wrappers.cs">
- <Link>Wrappers.cs</Link>
- </Compile>
- <Compile Include="..\Version.cs">
- <Link>Properties\Version.cs</Link>
- </Compile>
- <Compile Include="ParentForm.cs">
- <SubType>Form</SubType>
- </Compile>
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="TfsHelper.Vs2010.cs" />
- <Compile Include="TfsPlugin.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\GitTfs\GitTfs.csproj">
- <Project>{55C169E0-93CC-488C-9885-1D4EAF4EA236}</Project>
- <Name>GitTfs</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
- <Install>false</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
- <Visible>False</Visible>
- <ProductName>Windows Installer 3.1</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- 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">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
- <PropertyGroup>
- <PostBuildEvent>xcopy /y "$(TargetDir)*.dll" "$(SolutionDir)GitTfs\$(OutDir)"</PostBuildEvent>
- </PropertyGroup>
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{C5A374D3-A2E1-407C-9D6D-541FDB53BD62}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Sep.Git.Tfs.Vs2010</RootNamespace>
+ <AssemblyName>GitTfs.Vs2010</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>3.5</OldToolsVersion>
+ <UpgradeBackupLocation />
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ <TargetFrameworkProfile />
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="Microsoft.TeamFoundation, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
+ <Reference Include="Microsoft.TeamFoundation.Client, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
+ <Reference Include="Microsoft.TeamFoundation.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
+ <Reference Include="Microsoft.TeamFoundation.Common.Library, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
+ <Reference Include="Microsoft.TeamFoundation.VersionControl.Client, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
+ <Reference Include="Microsoft.TeamFoundation.WorkItemTracking.Client, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
+ <Reference Include="StructureMap, Version=2.5.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\lib\StructureMap\StructureMap.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml.Linq">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data.DataSetExtensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\CommonAssemblyInfo.cs">
+ <Link>Properties\CommonAssemblyInfo.cs</Link>
+ </Compile>
+ <Compile Include="..\GitTfs.VsCommon\TfsApiBridge.cs">
+ <Link>TfsApiBridge.cs</Link>
+ </Compile>
+ <Compile Include="..\GitTfs.VsCommon\TfsHelper.Common.cs">
+ <Link>TfsHelper.Common.cs</Link>
+ </Compile>
+ <Compile Include="..\GitTfs.VsCommon\Wrappers.cs">
+ <Link>Wrappers.cs</Link>
+ </Compile>
+ <Compile Include="..\Version.cs">
+ <Link>Properties\Version.cs</Link>
+ </Compile>
+ <Compile Include="ParentForm.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="TfsHelper.Vs2010.cs" />
+ <Compile Include="TfsPlugin.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\GitTfs\GitTfs.csproj">
+ <Project>{55C169E0-93CC-488C-9885-1D4EAF4EA236}</Project>
+ <Name>GitTfs</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+ <Visible>False</Visible>
+ <ProductName>Windows Installer 3.1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- 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">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+ <PropertyGroup>
+ <PostBuildEvent>xcopy /y "$(TargetDir)*.dll" "$(SolutionDir)GitTfs\$(OutDir)"</PostBuildEvent>
+ </PropertyGroup>
</Project>
View
54 GitTfs.Vs2010/ParentForm.cs
@@ -1,27 +1,27 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
-
-namespace Sep.Git.Tfs.Vs2010
-{
- public class ParentForm : Form
- {
- public ParentForm()
- {
- WindowState = FormWindowState.Minimized;
- ShowInTaskbar = false;
- FormBorderStyle = FormBorderStyle.None;
- StartPosition = FormStartPosition.CenterParent;
- }
-
- protected override void OnLoad(EventArgs e)
- {
- Visible = false;
- base.OnLoad(e);
- WindowState = FormWindowState.Normal;
- CenterToParent();
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+
+namespace Sep.Git.Tfs.Vs2010
+{
+ public class ParentForm : Form
+ {
+ public ParentForm()
+ {
+ WindowState = FormWindowState.Minimized;
+ ShowInTaskbar = false;
+ FormBorderStyle = FormBorderStyle.None;
+ StartPosition = FormStartPosition.CenterParent;
+ }
+
+ protected override void OnLoad(EventArgs e)
+ {
+ Visible = false;
+ base.OnLoad(e);
+ WindowState = FormWindowState.Normal;
+ CenterToParent();
+ }
+ }
+}
View
182 GitTfs.Vs2010/TfsHelper.Vs2010.cs
@@ -1,91 +1,91 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using Microsoft.TeamFoundation.Client;
-using Microsoft.TeamFoundation.VersionControl.Client;
-using Microsoft.Win32;
-using Sep.Git.Tfs.Core.TfsInterop;
-using Sep.Git.Tfs.Util;
-using Sep.Git.Tfs.Vs2010;
-
-namespace Sep.Git.Tfs.VsCommon
-{
- public partial class TfsHelper : ITfsHelper
- {
- private TfsTeamProjectCollection server;
-
- public string TfsClientLibraryVersion
- {
- get { return typeof(TfsTeamProjectCollection).Assembly.GetName().Version.ToString() + " (MS)"; }
- }
-
- private void UpdateServer()
- {
- if (string.IsNullOrEmpty(Url))
- {
- server = null;
- }
- else
- {
- server = new TfsTeamProjectCollection(new Uri(Url), new UICredentialsProvider());
- server.EnsureAuthenticated();
- }
- }
-
- private TfsTeamProjectCollection Server
- {
- get
- {
- return server;
- }
- }
-
- public bool CanShowCheckinDialog { get { return true; } }
-
- public long ShowCheckinDialog(IWorkspace workspace, IPendingChange[] pendingChanges, IEnumerable<IWorkItemCheckedInfo> checkedInfos, string checkinComment)
- {
- return ShowCheckinDialog(_bridge.Unwrap<Workspace>(workspace),
- pendingChanges.Select(p => _bridge.Unwrap<PendingChange>(p)).ToArray(),
- checkedInfos.Select(c => _bridge.Unwrap<WorkItemCheckedInfo>(c)).ToArray(),
- checkinComment);
- }
-
- private long ShowCheckinDialog(Workspace workspace, PendingChange[] pendingChanges,
- WorkItemCheckedInfo[] checkedInfos, string checkinComment)
- {
- using (var parentForm = new ParentForm())
- {
- parentForm.Show();
-
- var dialog = Activator.CreateInstance(GetCheckinDialogType(), new object[] {workspace.VersionControlServer});
-
- return dialog.Call<int>("Show", parentForm.Handle, workspace, pendingChanges, pendingChanges,
- checkinComment, null, null, checkedInfos);
- }
- }
-
- private const string DialogAssemblyName = "Microsoft.TeamFoundation.VersionControl.ControlAdapter";
-
- private static Type GetCheckinDialogType()
- {
- return GetDialogAssembly().GetType(DialogAssemblyName + ".CheckinDialog");
- }
-
- private static Assembly GetDialogAssembly()
- {
- return Assembly.LoadFrom(GetDialogAssemblyPath());
- }
-
- private static string GetDialogAssemblyPath()
- {
- return Path.Combine(GetVs2010InstallDir(), "PrivateAssemblies", DialogAssemblyName + ".dll");
- }
-
- private static string GetVs2010InstallDir()
- {
- return Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\VisualStudio\10.0").GetValue("InstallDir").ToString();
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using Microsoft.TeamFoundation.Client;
+using Microsoft.TeamFoundation.VersionControl.Client;
+using Microsoft.Win32;
+using Sep.Git.Tfs.Core.TfsInterop;
+using Sep.Git.Tfs.Util;
+using Sep.Git.Tfs.Vs2010;
+
+namespace Sep.Git.Tfs.VsCommon
+{
+ public partial class TfsHelper : ITfsHelper
+ {
+ private TfsTeamProjectCollection server;
+
+ public string TfsClientLibraryVersion
+ {
+ get { return typeof(TfsTeamProjectCollection).Assembly.GetName().Version.ToString() + " (MS)"; }
+ }
+
+ private void UpdateServer()
+ {
+ if (string.IsNullOrEmpty(Url))
+ {
+ server = null;
+ }
+ else
+ {
+ server = new TfsTeamProjectCollection(new Uri(Url), new UICredentialsProvider());
+ server.EnsureAuthenticated();
+ }
+ }
+
+ private TfsTeamProjectCollection Server
+ {
+ get
+ {
+ return server;
+ }
+ }
+
+ public bool CanShowCheckinDialog { get { return true; } }
+
+ public long ShowCheckinDialog(IWorkspace workspace, IPendingChange[] pendingChanges, IEnumerable<IWorkItemCheckedInfo> checkedInfos, string checkinComment)
+ {
+ return ShowCheckinDialog(_bridge.Unwrap<Workspace>(workspace),
+ pendingChanges.Select(p => _bridge.Unwrap<PendingChange>(p)).ToArray(),
+ checkedInfos.Select(c => _bridge.Unwrap<WorkItemCheckedInfo>(c)).ToArray(),
+ checkinComment);
+ }
+
+ private long ShowCheckinDialog(Workspace workspace, PendingChange[] pendingChanges,
+ WorkItemCheckedInfo[] checkedInfos, string checkinComment)
+ {
+ using (var parentForm = new ParentForm())
+ {
+ parentForm.Show();
+
+ var dialog = Activator.CreateInstance(GetCheckinDialogType(), new object[] {workspace.VersionControlServer});
+
+ return dialog.Call<int>("Show", parentForm.Handle, workspace, pendingChanges, pendingChanges,
+ checkinComment, null, null, checkedInfos);
+ }
+ }
+
+ private const string DialogAssemblyName = "Microsoft.TeamFoundation.VersionControl.ControlAdapter";
+
+ private static Type GetCheckinDialogType()
+ {
+ return GetDialogAssembly().GetType(DialogAssemblyName + ".CheckinDialog");
+ }
+
+ private static Assembly GetDialogAssembly()
+ {
+ return Assembly.LoadFrom(GetDialogAssemblyPath());
+ }
+
+ private static string GetDialogAssemblyPath()
+ {
+ return Path.Combine(GetVs2010InstallDir(), "PrivateAssemblies", DialogAssemblyName + ".dll");
+ }
+
+ private static string GetVs2010InstallDir()
+ {
+ return Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\VisualStudio\10.0").GetValue("InstallDir").ToString();
+ }
+ }
+}
View
188 GitTfs.VsCommon/TfsHelper.Common.cs
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
-using System.Linq;
+using System.Linq;
using Microsoft.TeamFoundation.Server;
using Microsoft.TeamFoundation.VersionControl.Client;
using Microsoft.TeamFoundation.WorkItemTracking.Client;
@@ -17,27 +17,27 @@ public partial class TfsHelper : ITfsHelper
{
private readonly TextWriter _stdout;
private string _url;
- private readonly TfsApiBridge _bridge;
- private readonly IContainer _container;
-
+ private readonly TfsApiBridge _bridge;
+ private readonly IContainer _container;
+
public TfsHelper(TextWriter stdout, TfsApiBridge bridge, IContainer container)
{
_stdout = stdout;
- _bridge = bridge;
- _container = container;
+ _bridge = bridge;
+ _container = container;
}
public string Url
{
get { return _url; }
set { _url = value; UpdateServer(); }
- }
-
- private string[] _legacyUrls;
- public string[] LegacyUrls
- {
- get { return _legacyUrls ?? (_legacyUrls = new string[0]); }
- set { _legacyUrls = value; }
+ }
+
+ private string[] _legacyUrls;
+ public string[] LegacyUrls
+ {
+ get { return _legacyUrls ?? (_legacyUrls = new string[0]); }
+ set { _legacyUrls = value; }
}
private VersionControlServer VersionControl
@@ -105,60 +105,60 @@ public void WithWorkspace(string localDirectory, IGitTfsRemote remote, TfsChange
}
private Workspace GetWorkspace(string localDirectory, string repositoryPath)
- {
- try
- {
- var workspace = VersionControl.CreateWorkspace(GenerateWorkspaceName());
- workspace.CreateMapping(new WorkingFolder(repositoryPath, localDirectory));
- return workspace;
- }
- catch (MappingConflictException e)
- {
- throw new GitTfsException(e.Message, new string[] { "Run 'git tfs cleanup-workspace' to remove the workspace." }, e);
- }
+ {
+ try
+ {
+ var workspace = VersionControl.CreateWorkspace(GenerateWorkspaceName());
+ workspace.CreateMapping(new WorkingFolder(repositoryPath, localDirectory));
+ return workspace;
+ }
+ catch (MappingConflictException e)
+ {
+ throw new GitTfsException(e.Message, new string[] { "Run 'git tfs cleanup-workspace' to remove the workspace." }, e);
+ }
}
private string GenerateWorkspaceName()
{
return "git-tfs-" + Guid.NewGuid().ToString();
- }
-
- public void CleanupWorkspaces(string workingDirectory)
- {
- Trace.WriteLine("Looking for workspaces mapped to @\"" + workingDirectory +"\"...", "cleanup-workspace");
- var workspace = VersionControl.TryGetWorkspace(workingDirectory);
- if(workspace != null)
- {
- Trace.WriteLine("Found mapping in workspace \"" + workspace.DisplayName + "\".", "cleanup-workspace");
- if (workspace.Folders.Length == 1)
- {
- _stdout.WriteLine("Removing workspace \"" + workspace.DisplayName + "\".");
- workspace.Delete();
- }
- else
- {
- foreach (var mapping in workspace.Folders.Where(f => Path.GetFullPath(f.LocalItem).ToLower() == Path.GetFullPath(workingDirectory).ToLower()))
- {
- _stdout.WriteLine("Removing @\"" + mapping.LocalItem + "\" from workspace \"" + workspace.DisplayName + "\".");
- workspace.DeleteMapping(mapping);
- }
-
- }
- }
- }
-
- public bool HasShelveset(string shelvesetName)
- {
- var matchingShelvesets = VersionControl.QueryShelvesets(shelvesetName, VersionControl.AuthenticatedUser);
- return matchingShelvesets != null && matchingShelvesets.Length > 0;
- }
-
- public IShelveset CreateShelveset(IWorkspace workspace, string shelvesetName)
- {
- var shelveset = new Shelveset(_bridge.Unwrap<Workspace>(workspace).VersionControlServer, shelvesetName, workspace.OwnerName);
- return _bridge.Wrap<WrapperForShelveset, Shelveset>(shelveset);
- }
-
+ }
+
+ public void CleanupWorkspaces(string workingDirectory)
+ {
+ Trace.WriteLine("Looking for workspaces mapped to @\"" + workingDirectory +"\"...", "cleanup-workspace");
+ var workspace = VersionControl.TryGetWorkspace(workingDirectory);
+ if(workspace != null)
+ {
+ Trace.WriteLine("Found mapping in workspace \"" + workspace.DisplayName + "\".", "cleanup-workspace");
+ if (workspace.Folders.Length == 1)
+ {
+ _stdout.WriteLine("Removing workspace \"" + workspace.DisplayName + "\".");
+ workspace.Delete();
+ }
+ else
+ {
+ foreach (var mapping in workspace.Folders.Where(f => Path.GetFullPath(f.LocalItem).ToLower() == Path.GetFullPath(workingDirectory).ToLower()))
+ {
+ _stdout.WriteLine("Removing @\"" + mapping.LocalItem + "\" from workspace \"" + workspace.DisplayName + "\".");
+ workspace.DeleteMapping(mapping);
+ }
+
+ }
+ }
+ }
+
+ public bool HasShelveset(string shelvesetName)
+ {
+ var matchingShelvesets = VersionControl.QueryShelvesets(shelvesetName, VersionControl.AuthenticatedUser);
+ return matchingShelvesets != null && matchingShelvesets.Length > 0;
+ }
+
+ public IShelveset CreateShelveset(IWorkspace workspace, string shelvesetName)
+ {
+ var shelveset = new Shelveset(_bridge.Unwrap<Workspace>(workspace).VersionControlServer, shelvesetName, workspace.OwnerName);
+ return _bridge.Wrap<WrapperForShelveset, Shelveset>(shelveset);
+ }
+
public IIdentity GetIdentity(string username)
{
return _bridge.Wrap<WrapperForIdentity, Identity>(GroupSecurityService.ReadIdentity(SearchFactor.AccountName, username, QueryMembership.None));
@@ -175,35 +175,35 @@ public ITfsChangeset GetLatestChangeset(GitTfsRemote remote)
public IChangeset GetChangeset(int changesetId)
{
return _bridge.Wrap<WrapperForChangeset, Changeset>(VersionControl.GetChangeset(changesetId));
- }
-
- public bool MatchesUrl(string tfsUrl)
- {
- return Url == tfsUrl || LegacyUrls.Contains(tfsUrl);
- }
-
- public IEnumerable<IWorkItemCheckinInfo> GetWorkItemInfos(IEnumerable<string> workItems, TfsWorkItemCheckinAction checkinAction)
- {
- return
- GetWorkItemInfosHelper<IWorkItemCheckinInfo, WrapperForWorkItemCheckinInfo, WorkItemCheckinInfo>(
- workItems, checkinAction, GetWorkItemInfo);
- }
-
- public IEnumerable<IWorkItemCheckedInfo> GetWorkItemCheckedInfos(IEnumerable<string> workItems, TfsWorkItemCheckinAction checkinAction)
- {
- return
- GetWorkItemInfosHelper<IWorkItemCheckedInfo, WrapperForWorkItemCheckedInfo, WorkItemCheckedInfo>(
- workItems, checkinAction, GetWorkItemCheckedInfo);
- }
-
- private IEnumerable<TInterface> GetWorkItemInfosHelper<TInterface, TWrapper, TInstance>(IEnumerable<string> workItems,
- TfsWorkItemCheckinAction checkinAction, Func<string, WorkItemCheckinAction, TInstance> func)
- where TWrapper : class
- {
- return (from workItem in workItems
- select _bridge.Wrap<TWrapper, TInstance>(
- func(workItem, _bridge.Convert<WorkItemCheckinAction>(checkinAction))))
- .Cast<TInterface>();
+ }
+
+ public bool MatchesUrl(string tfsUrl)
+ {
+ return Url == tfsUrl || LegacyUrls.Contains(tfsUrl);
+ }
+
+ public IEnumerable<IWorkItemCheckinInfo> GetWorkItemInfos(IEnumerable<string> workItems, TfsWorkItemCheckinAction checkinAction)
+ {
+ return
+ GetWorkItemInfosHelper<IWorkItemCheckinInfo, WrapperForWorkItemCheckinInfo, WorkItemCheckinInfo>(
+ workItems, checkinAction, GetWorkItemInfo);
+ }
+
+ public IEnumerable<IWorkItemCheckedInfo> GetWorkItemCheckedInfos(IEnumerable<string> workItems, TfsWorkItemCheckinAction checkinAction)
+ {
+ return
+ GetWorkItemInfosHelper<IWorkItemCheckedInfo, WrapperForWorkItemCheckedInfo, WorkItemCheckedInfo>(
+ workItems, checkinAction, GetWorkItemCheckedInfo);
+ }
+
+ private IEnumerable<TInterface> GetWorkItemInfosHelper<TInterface, TWrapper, TInstance>(IEnumerable<string> workItems,
+ TfsWorkItemCheckinAction checkinAction, Func<string, WorkItemCheckinAction, TInstance> func)
+ where TWrapper : class
+ {
+ return (from workItem in workItems
+ select _bridge.Wrap<TWrapper, TInstance>(
+ func(workItem, _bridge.Convert<WorkItemCheckinAction>(checkinAction))))
+ .Cast<TInterface>();
}
private WorkItemCheckinInfo GetWorkItemInfo(string workItem, WorkItemCheckinAction checkinAction)
@@ -213,9 +213,9 @@ private WorkItemCheckinInfo GetWorkItemInfo(string workItem, WorkItemCheckinActi
- private static WorkItemCheckedInfo GetWorkItemCheckedInfo(string workitem, WorkItemCheckinAction checkinAction)
- {
- return new WorkItemCheckedInfo(Convert.ToInt32(workitem), true, checkinAction);
+ private static WorkItemCheckedInfo GetWorkItemCheckedInfo(string workitem, WorkItemCheckinAction checkinAction)
+ {
+ return new WorkItemCheckedInfo(Convert.ToInt32(workitem), true, checkinAction);
}
}
}
View
16 GitTfs.VsCommon/Wrappers.cs
@@ -204,14 +204,14 @@ public class WrapperForWorkItemCheckinInfo : WrapperFor<WorkItemCheckinInfo>, IW
public WrapperForWorkItemCheckinInfo(WorkItemCheckinInfo workItemCheckinInfo) : base(workItemCheckinInfo)
{
}
- }
-
- public class WrapperForWorkItemCheckedInfo : WrapperFor<WorkItemCheckedInfo>, IWorkItemCheckedInfo
- {
- public WrapperForWorkItemCheckedInfo(WorkItemCheckedInfo workItemCheckinInfo)
- : base(workItemCheckinInfo)
- {
- }
+ }
+
+ public class WrapperForWorkItemCheckedInfo : WrapperFor<WorkItemCheckedInfo>, IWorkItemCheckedInfo
+ {
+ public WrapperForWorkItemCheckedInfo(WorkItemCheckedInfo workItemCheckinInfo)
+ : base(workItemCheckinInfo)
+ {
+ }
}
public class WrapperForPendingChange : WrapperFor<PendingChange>, IPendingChange
View
124 GitTfs.sln
@@ -1,62 +1,62 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1F1648A7-FD88-4016-82DB-35E25BCBB038}"
- ProjectSection(SolutionItems) = preProject
- GitTfs.vsmdi = GitTfs.vsmdi
- GitTfs1.vsmdi = GitTfs1.vsmdi
- LocalTestRun.testrunconfig = LocalTestRun.testrunconfig
- README = README
- TODO = TODO
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitTfs", "GitTfs\GitTfs.csproj", "{55C169E0-93CC-488C-9885-1D4EAF4EA236}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitTfsTest", "GitTfsTest\GitTfsTest.csproj", "{DDFB4746-2BCE-4B34-8E45-056324CF140D}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitTfsBenchmarks", "GitTfsBenchmarks\GitTfsBenchmarks.csproj", "{7C7FEA7A-24A1-4834-9815-1DF980C340F3}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitTfs.Vs2008", "GitTfs.Vs2008\GitTfs.Vs2008.csproj", "{09BF8124-19A8-45BE-896B-536CA0F3F0FC}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitTfs.Vs2010", "GitTfs.Vs2010\GitTfs.Vs2010.csproj", "{C5A374D3-A2E1-407C-9D6D-541FDB53BD62}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitTfsTest.Vs2010", "GitTfsTest.Vs2010\GitTfsTest.Vs2010.csproj", "{B2BF1C1C-BB58-4DEF-BFEF-DE0D2FE2E8F7}"
-EndProject
-Global
- GlobalSection(TestCaseManagementSettings) = postSolution
- CategoryFile = GitTfs1.vsmdi
- EndGlobalSection
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|x86 = Debug|x86
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {55C169E0-93CC-488C-9885-1D4EAF4EA236}.Debug|x86.ActiveCfg = Debug|x86
- {55C169E0-93CC-488C-9885-1D4EAF4EA236}.Debug|x86.Build.0 = Debug|x86
- {55C169E0-93CC-488C-9885-1D4EAF4EA236}.Release|x86.ActiveCfg = Release|x86
- {55C169E0-93CC-488C-9885-1D4EAF4EA236}.Release|x86.Build.0 = Release|x86
- {DDFB4746-2BCE-4B34-8E45-056324CF140D}.Debug|x86.ActiveCfg = Debug|x86
- {DDFB4746-2BCE-4B34-8E45-056324CF140D}.Debug|x86.Build.0 = Debug|x86
- {DDFB4746-2BCE-4B34-8E45-056324CF140D}.Release|x86.ActiveCfg = Release|x86
- {DDFB4746-2BCE-4B34-8E45-056324CF140D}.Release|x86.Build.0 = Release|x86
- {7C7FEA7A-24A1-4834-9815-1DF980C340F3}.Debug|x86.ActiveCfg = Debug|x86
- {7C7FEA7A-24A1-4834-9815-1DF980C340F3}.Debug|x86.Build.0 = Debug|x86
- {7C7FEA7A-24A1-4834-9815-1DF980C340F3}.Release|x86.ActiveCfg = Release|x86
- {7C7FEA7A-24A1-4834-9815-1DF980C340F3}.Release|x86.Build.0 = Release|x86
- {09BF8124-19A8-45BE-896B-536CA0F3F0FC}.Debug|x86.ActiveCfg = Debug|x86
- {09BF8124-19A8-45BE-896B-536CA0F3F0FC}.Debug|x86.Build.0 = Debug|x86
- {09BF8124-19A8-45BE-896B-536CA0F3F0FC}.Release|x86.ActiveCfg = Release|x86
- {09BF8124-19A8-45BE-896B-536CA0F3F0FC}.Release|x86.Build.0 = Release|x86
- {C5A374D3-A2E1-407C-9D6D-541FDB53BD62}.Debug|x86.ActiveCfg = Debug|x86
- {C5A374D3-A2E1-407C-9D6D-541FDB53BD62}.Debug|x86.Build.0 = Debug|x86
- {C5A374D3-A2E1-407C-9D6D-541FDB53BD62}.Release|x86.ActiveCfg = Release|x86
- {C5A374D3-A2E1-407C-9D6D-541FDB53BD62}.Release|x86.Build.0 = Release|x86
- {B2BF1C1C-BB58-4DEF-BFEF-DE0D2FE2E8F7}.Debug|x86.ActiveCfg = Debug|x86
- {B2BF1C1C-BB58-4DEF-BFEF-DE0D2FE2E8F7}.Debug|x86.Build.0 = Debug|x86
- {B2BF1C1C-BB58-4DEF-BFEF-DE0D2FE2E8F7}.Release|x86.ActiveCfg = Release|x86
- {B2BF1C1C-BB58-4DEF-BFEF-DE0D2FE2E8F7}.Release|x86.Build.0 = Release|x86
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1F1648A7-FD88-4016-82DB-35E25BCBB038}"
+ ProjectSection(SolutionItems) = preProject
+ GitTfs.vsmdi = GitTfs.vsmdi
+ GitTfs1.vsmdi = GitTfs1.vsmdi
+ LocalTestRun.testrunconfig = LocalTestRun.testrunconfig
+ README = README
+ TODO = TODO
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitTfs", "GitTfs\GitTfs.csproj", "{55C169E0-93CC-488C-9885-1D4EAF4EA236}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitTfsTest", "GitTfsTest\GitTfsTest.csproj", "{DDFB4746-2BCE-4B34-8E45-056324CF140D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitTfsBenchmarks", "GitTfsBenchmarks\GitTfsBenchmarks.csproj", "{7C7FEA7A-24A1-4834-9815-1DF980C340F3}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitTfs.Vs2008", "GitTfs.Vs2008\GitTfs.Vs2008.csproj", "{09BF8124-19A8-45BE-896B-536CA0F3F0FC}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitTfs.Vs2010", "GitTfs.Vs2010\GitTfs.Vs2010.csproj", "{C5A374D3-A2E1-407C-9D6D-541FDB53BD62}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitTfsTest.Vs2010", "GitTfsTest.Vs2010\GitTfsTest.Vs2010.csproj", "{B2BF1C1C-BB58-4DEF-BFEF-DE0D2FE2E8F7}"
+EndProject
+Global
+ GlobalSection(TestCaseManagementSettings) = postSolution
+ CategoryFile = GitTfs1.vsmdi
+ EndGlobalSection
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x86 = Debug|x86
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {55C169E0-93CC-488C-9885-1D4EAF4EA236}.Debug|x86.ActiveCfg = Debug|x86
+ {55C169E0-93CC-488C-9885-1D4EAF4EA236}.Debug|x86.Build.0 = Debug|x86
+ {55C169E0-93CC-488C-9885-1D4EAF4EA236}.Release|x86.ActiveCfg = Release|x86
+ {55C169E0-93CC-488C-9885-1D4EAF4EA236}.Release|x86.Build.0 = Release|x86
+ {DDFB4746-2BCE-4B34-8E45-056324CF140D}.Debug|x86.ActiveCfg = Debug|x86
+ {DDFB4746-2BCE-4B34-8E45-056324CF140D}.Debug|x86.Build.0 = Debug|x86
+ {DDFB4746-2BCE-4B34-8E45-056324CF140D}.Release|x86.ActiveCfg = Release|x86
+ {DDFB4746-2BCE-4B34-8E45-056324CF140D}.Release|x86.Build.0 = Release|x86
+ {7C7FEA7A-24A1-4834-9815-1DF980C340F3}.Debug|x86.ActiveCfg = Debug|x86
+ {7C7FEA7A-24A1-4834-9815-1DF980C340F3}.Debug|x86.Build.0 = Debug|x86
+ {7C7FEA7A-24A1-4834-9815-1DF980C340F3}.Release|x86.ActiveCfg = Release|x86
+ {7C7FEA7A-24A1-4834-9815-1DF980C340F3}.Release|x86.Build.0 = Release|x86
+ {09BF8124-19A8-45BE-896B-536CA0F3F0FC}.Debug|x86.ActiveCfg = Debug|x86
+ {09BF8124-19A8-45BE-896B-536CA0F3F0FC}.Debug|x86.Build.0 = Debug|x86
+ {09BF8124-19A8-45BE-896B-536CA0F3F0FC}.Release|x86.ActiveCfg = Release|x86
+ {09BF8124-19A8-45BE-896B-536CA0F3F0FC}.Release|x86.Build.0 = Release|x86
+ {C5A374D3-A2E1-407C-9D6D-541FDB53BD62}.Debug|x86.ActiveCfg = Debug|x86
+ {C5A374D3-A2E1-407C-9D6D-541FDB53BD62}.Debug|x86.Build.0 = Debug|x86
+ {C5A374D3-A2E1-407C-9D6D-541FDB53BD62}.Release|x86.ActiveCfg = Release|x86
+ {C5A374D3-A2E1-407C-9D6D-541FDB53BD62}.Release|x86.Build.0 = Release|x86
+ {B2BF1C1C-BB58-4DEF-BFEF-DE0D2FE2E8F7}.Debug|x86.ActiveCfg = Debug|x86
+ {B2BF1C1C-BB58-4DEF-BFEF-DE0D2FE2E8F7}.Debug|x86.Build.0 = Debug|x86
+ {B2BF1C1C-BB58-4DEF-BFEF-DE0D2FE2E8F7}.Release|x86.ActiveCfg = Release|x86
+ {B2BF1C1C-BB58-4DEF-BFEF-DE0D2FE2E8F7}.Release|x86.Build.0 = Release|x86
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
View
20 GitTfs.vsmdi
@@ -1,11 +1,11 @@
-<?xml version="1.0" encoding="utf-8"?>
-<TestLists xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
- <TestList name="Lists of Tests" id="8c43106b-9dc1-4907-a29f-aa66a61bf5b6">
- <RunConfiguration id="5655a60c-4b6a-4d38-b593-3d93e2d5c1a2" name="Local Test Run" storage="localtestrun.testrunconfig" type="Microsoft.VisualStudio.TestTools.Common.TestRunConfiguration, Microsoft.VisualStudio.QualityTools.Common, PublicKeyToken=b03f5f7f11d50a3a" />
- </TestList>
- <TestList name="Results Not in a List" id="8c84fa94-04c1-424b-9868-57a2d4851a1d">
- <TestLinks>
- <TestLink id="93c5a086-fc39-0ab2-9077-b5ae2e028ce2" name="ShouldWriteCommandHelp" storage="gittfstest\bin\debug\gittfstest.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" />
- </TestLinks>
- </TestList>
+<?xml version="1.0" encoding="utf-8"?>
+<TestLists xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
+ <TestList name="Lists of Tests" id="8c43106b-9dc1-4907-a29f-aa66a61bf5b6">
+ <RunConfiguration id="5655a60c-4b6a-4d38-b593-3d93e2d5c1a2" name="Local Test Run" storage="localtestrun.testrunconfig" type="Microsoft.VisualStudio.TestTools.Common.TestRunConfiguration, Microsoft.VisualStudio.QualityTools.Common, PublicKeyToken=b03f5f7f11d50a3a" />
+ </TestList>
+ <TestList name="Results Not in a List" id="8c84fa94-04c1-424b-9868-57a2d4851a1d">
+ <TestLinks>
+ <TestLink id="93c5a086-fc39-0ab2-9077-b5ae2e028ce2" name="ShouldWriteCommandHelp" storage="gittfstest\bin\debug\gittfstest.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" />
+ </TestLinks>
+ </TestList>
</TestLists>
View
48 GitTfs/Commands/CheckinTool.cs
@@ -1,27 +1,27 @@
-using System.ComponentModel;
-using System.IO;
-using Sep.Git.Tfs.Core;
-using Sep.Git.Tfs.Util;
-
+using System.ComponentModel;
+using System.IO;
+using Sep.Git.Tfs.Core;
+using Sep.Git.Tfs.Util;
+
namespace Sep.Git.Tfs.Commands
-{
- [PluggableWithAliases("checkintool", "ct")]
- [Description("checkintool [options] [ref-to-checkin]")]
- [RequiresValidGitRepository]
- public class CheckinTool : CheckinBase
- {
- public CheckinTool(TextWriter stdout, CheckinOptions checkinOptions, TfsWriter writer) : base(stdout, checkinOptions, writer)
- {
- }
-
- protected override long DoCheckin(TfsChangesetInfo changeset, string refToCheckin)
- {
- if (!changeset.Remote.Tfs.CanShowCheckinDialog)
- throw new GitTfsException(
- "checkintool does not work with this TFS version (" + changeset.Remote.Tfs.TfsClientLibraryVersion + ").",
- new[] {"Try installing the VS2010 edition of Team Explorer."});
-
- return changeset.Remote.CheckinTool(refToCheckin, changeset);
- }
+{
+ [PluggableWithAliases("checkintool", "ct")]
+ [Description("checkintool [options] [ref-to-checkin]")]
+ [RequiresValidGitRepository]
+ public class CheckinTool : CheckinBase
+ {
+ public CheckinTool(TextWriter stdout, CheckinOptions checkinOptions, TfsWriter writer) : base(stdout, checkinOptions, writer)
+ {
+ }
+
+ protected override long DoCheckin(TfsChangesetInfo changeset, string refToCheckin)
+ {
+ if (!changeset.Remote.Tfs.CanShowCheckinDialog)
+ throw new GitTfsException(
+ "checkintool does not work with this TFS version (" + changeset.Remote.Tfs.TfsClientLibraryVersion + ").",
+ new[] {"Try installing the VS2010 edition of Team Explorer."});
+
+ return changeset.Remote.CheckinTool(refToCheckin, changeset);
+ }
}
}
View
22 GitTfs/Commands/Clone.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
@@ -28,17 +28,17 @@ public IEnumerable<IOptionResults> ExtraOptions
get { return this.MakeNestedOptionResults(init, fetch); }
}
- public int Run(string tfsUrl, string tfsRepositoryPath)
- {
- return Run(tfsUrl, tfsRepositoryPath, Path.GetFileName(tfsRepositoryPath));
- }
-
+ public int Run(string tfsUrl, string tfsRepositoryPath)
+ {
+ return Run(tfsUrl, tfsRepositoryPath, Path.GetFileName(tfsRepositoryPath));
+ }
+
public int Run(string tfsUrl, string tfsRepositoryPath, string gitRepositoryPath)
- {
- var retVal = 0;
- retVal = init.Run(tfsUrl, tfsRepositoryPath, gitRepositoryPath);
- if (retVal == 0) retVal = fetch.Run();
- if (retVal == 0) globals.Repository.CommandNoisy("merge", globals.Repository.ReadAllTfsRemotes().First().RemoteRef);
+ {
+ var retVal = 0;
+ retVal = init.Run(tfsUrl, tfsRepositoryPath, gitRepositoryPath);
+ if (retVal == 0) retVal = fetch.Run();
+ if (retVal == 0) globals.Repository.CommandNoisy("merge", globals.Repository.ReadAllTfsRemotes().First().RemoteRef);
return retVal;
}
}
View
158 GitTfs/Commands/Fetch.cs
@@ -1,79 +1,79 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Text.RegularExpressions;
-using CommandLine.OptParse;
-using Sep.Git.Tfs.Core;
-using StructureMap;
-
-namespace Sep.Git.Tfs.Commands
-{
- [Pluggable("fetch")]
- [Description("fetch [options] [tfs-remote-id]...")]
- [RequiresValidGitRepository]
- public class Fetch : GitTfsCommand
- {
- private readonly FcOptions fcOptions;
- private readonly RemoteOptions remoteOptions;
- private readonly Globals globals;
-
- public Fetch(Globals globals, RemoteOptions remoteOptions, FcOptions fcOptions)
- {
- this.fcOptions = fcOptions;
- this.remoteOptions = remoteOptions;
- this.globals = globals;
- }
-
-// [OptDef(OptValType.ValueReq)]
-// [ShortOptionName('r')]
-// public int? revision { get; set; }
-
- [OptDef(OptValType.Flag)]
- [LongOptionName("fetch-all")]
- public bool all { get; set; }
-
- [OptDef(OptValType.Flag)]
- [ShortOptionName('p')]
- public bool parents { get; set; }
-
- public IEnumerable<IOptionResults> ExtraOptions
- {
- get { return this.MakeNestedOptionResults(fcOptions, remoteOptions); }
- }
-
- public int Run()
- {
- return Run(globals.RemoteId);
- }
-
- public int Run(params string[] args)
- {
- foreach(var remote in GetRemotesToFetch(args))
- {
- Trace.WriteLine("Fetching from TFS remote " + remote.Id);
- DoFetch(remote);
- }
- return 0;
- }
-
- protected virtual void DoFetch(IGitTfsRemote remote)
- {
- remote.Fetch();
- }
-
- private IEnumerable<IGitTfsRemote> GetRemotesToFetch(IList<string> args)
- {
- IEnumerable<IGitTfsRemote> remotesToFetch;
- if (parents)
- remotesToFetch = globals.Repository.GetParentTfsCommits("HEAD").Select(commit => commit.Remote);
- else if (all)
- remotesToFetch = globals.Repository.ReadAllTfsRemotes();
- else
- remotesToFetch = args.Select(arg => globals.Repository.ReadTfsRemote(arg));
- return remotesToFetch;
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text.RegularExpressions;
+using CommandLine.OptParse;
+using Sep.Git.Tfs.Core;
+using StructureMap;
+
+namespace Sep.Git.Tfs.Commands
+{
+ [Pluggable("fetch")]
+ [Description("fetch [options] [tfs-remote-id]...")]
+ [RequiresValidGitRepository]
+ public class Fetch : GitTfsCommand
+ {
+ private readonly FcOptions fcOptions;
+ private readonly RemoteOptions remoteOptions;
+ private readonly Globals globals;
+
+ public Fetch(Globals globals, RemoteOptions remoteOptions, FcOptions fcOptions)
+ {
+ this.fcOptions = fcOptions;
+ this.remoteOptions = remoteOptions;
+ this.globals = globals;
+ }
+
+// [OptDef(OptValType.ValueReq)]
+// [ShortOptionName('r')]
+// public int? revision { get; set; }
+
+ [OptDef(OptValType.Flag)]
+ [LongOptionName("fetch-all")]
+ public bool all { get; set; }
+
+ [OptDef(OptValType.Flag)]
+ [ShortOptionName('p')]
+ public bool parents { get; set; }
+
+ public IEnumerable<IOptionResults> ExtraOptions
+ {
+ get { return this.MakeNestedOptionResults(fcOptions, remoteOptions); }
+ }
+
+ public int Run()
+ {
+ return Run(globals.RemoteId);
+ }
+
+ public int Run(params string[] args)
+ {
+ foreach(var remote in GetRemotesToFetch(args))
+ {
+ Trace.WriteLine("Fetching from TFS remote " + remote.Id);
+ DoFetch(remote);
+ }
+ return 0;
+ }
+
+ protected virtual void DoFetch(IGitTfsRemote remote)
+ {
+ remote.Fetch();
+ }
+
+ private IEnumerable<IGitTfsRemote> GetRemotesToFetch(IList<string> args)
+ {
+ IEnumerable<IGitTfsRemote> remotesToFetch;
+ if (parents)
+ remotesToFetch = globals.Repository.GetParentTfsCommits("HEAD").Select(commit => commit.Remote);
+ else if (all)
+ remotesToFetch = globals.Repository.ReadAllTfsRemotes();
+ else
+ remotesToFetch = args.Select(arg => globals.Repository.ReadTfsRemote(arg));
+ return remotesToFetch;
+ }
+ }
+}
View
128 GitTfs/Commands/Help.cs
@@ -1,31 +1,31 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
+using System.Collections.Generic;
+using System.ComponentModel;
using System.IO;
using System.Linq;
using CommandLine.OptParse;
-using Sep.Git.Tfs.Core;
-using Sep.Git.Tfs.Util;
-using StructureMap;
-using StructureMap.Pipeline;
-using StructureMap.Query;
-using IContainer = StructureMap.IContainer;
-
+using Sep.Git.Tfs.Core;
+using Sep.Git.Tfs.Util;
+using StructureMap;
+using StructureMap.Pipeline;
+using StructureMap.Query;
+using IContainer = StructureMap.IContainer;
+
namespace Sep.Git.Tfs.Commands
{
[Pluggable("help")]
[Description("help [command-name]")]
public class Help : GitTfsCommand
{
- private readonly TextWriter output;
- private readonly GitTfsCommandFactory commandFactory;
- private readonly IContainer _container;
-
+ private readonly TextWriter output;
+ private readonly GitTfsCommandFactory commandFactory;
+ private readonly IContainer _container;
+
public Help(TextWriter output, GitTfsCommandFactory commandFactory, IContainer container)
{
- this.output = output;
- this.commandFactory = commandFactory;
- _container = container;
+ this.output = output;
+ this.commandFactory = commandFactory;
+ _container = container;
}
public IEnumerable<IOptionResults> ExtraOptions
@@ -39,15 +39,15 @@ public IEnumerable<IOptionResults> ExtraOptions
/// </summary>
public int Run(IList<string> args)
{
- foreach(var arg in args)
- {
+ foreach(var arg in args)
+ {
var command = commandFactory.GetCommand(arg);
if(command != null)
{
return Run(command);
}
- }
- return GitTfsExitCodes.InvalidArguments;
+ }
+ return GitTfsExitCodes.InvalidArguments;
}
/// <summary>
@@ -56,17 +56,17 @@ public int Run(IList<string> args)
public int Run()
{
output.WriteLine("Usage: git-tfs [command] [options]");
- foreach(var pair in GetCommandMap())
+ foreach(var pair in GetCommandMap())
{
- output.Write(" " + pair.Key);
-
- if (pair.Value.Any())
- {
- output.WriteLine(" (" + string.Join(", ", pair.Value) + ")");
- }
- else
- {
- output.WriteLine();
+ output.Write(" " + pair.Key);
+
+ if (pair.Value.Any())
+ {
+ output.WriteLine(" (" + string.Join(", ", pair.Value) + ")");
+ }
+ else
+ {
+ output.WriteLine();
}
}
output.WriteLine(" (use 'git-tfs help [command]' for more information)");
@@ -91,55 +91,55 @@ public int Run(GitTfsCommand command)
return GitTfsExitCodes.Help;
}
- private Dictionary<string, IEnumerable<string>> GetCommandMap()
- {
- return (from instance in GetCommandInstances()
- where instance.Name != null
- orderby instance.Name
- select instance.Name)
- .ToDictionary(s => s, s => commandFactory.GetAliasesForCommandName(s));
- }
-
- private string GetCommandName(GitTfsCommand command)
- {
- return (from instance in GetCommandInstances()
- where instance.ConcreteType == command.GetType()
- select instance.Name).Single();
- }
-
- private IEnumerable<InstanceRef> GetCommandInstances()
- {
- return _container.Model
- .PluginTypes
- .Single(p => p.PluginType == typeof (GitTfsCommand))
- .Instances
- .Where(i => i != null);
+ private Dictionary<string, IEnumerable<string>> GetCommandMap()
+ {
+ return (from instance in GetCommandInstances()
+ where instance.Name != null
+ orderby instance.Name
+ select instance.Name)
+ .ToDictionary(s => s, s => commandFactory.GetAliasesForCommandName(s));
+ }
+
+ private string GetCommandName(GitTfsCommand command)
+ {
+ return (from instance in GetCommandInstances()
+ where instance.ConcreteType == command.GetType()
+ select instance.Name).Single();
+ }
+
+ private IEnumerable<InstanceRef> GetCommandInstances()
+ {
+ return _container.Model
+ .PluginTypes
+ .Single(p => p.PluginType == typeof (GitTfsCommand))
+ .Instances
+ .Where(i => i != null);
}
private string GetCommandUsage(GitTfsCommand command)
{
var descriptionAttribute =
command.GetType().GetCustomAttributes(typeof (DescriptionAttribute), false).FirstOrDefault() as
- DescriptionAttribute;
+ DescriptionAttribute;
var commandName = GetCommandName(command);
return (descriptionAttribute != null)
? descriptionAttribute.Description
: commandName + " [options]";
}
}
- public interface IHelpHelper
- {
- int ShowHelp(GitTfsCommand command);
- int ShowHelpForInvalidArguments(GitTfsCommand command);
+ public interface IHelpHelper
+ {
+ int ShowHelp(GitTfsCommand command);
+ int ShowHelpForInvalidArguments(GitTfsCommand command);
}
public class HelpHelper : IHelpHelper
- {
- private readonly IContainer _container;
-
- public HelpHelper(IContainer container)
- {
- _container = container;
+ {
+ private readonly IContainer _container;
+
+ public HelpHelper(IContainer container)
+ {
+ _container = container;
}
public int ShowHelp(GitTfsCommand command)
View
28 GitTfs/Commands/QuickClone.cs
@@ -1,14 +1,14 @@
-using System.ComponentModel;
-using StructureMap;
-
-namespace Sep.Git.Tfs.Commands
-{
- [Pluggable("quick-clone")]
- [Description("quick-clone [options] tfs-url repository-path <git-repository-path>")]
- public class QuickClone : Clone
- {
- public QuickClone(Globals globals, Init init, QuickFetch fetch) : base(globals, fetch, init)
- {
- }
- }
-}
+using System.ComponentModel;
+using StructureMap;
+
+namespace Sep.Git.Tfs.Commands
+{
+ [Pluggable("quick-clone")]
+ [Description("quick-clone [options] tfs-url repository-path <git-repository-path>")]
+ public class QuickClone : Clone
+ {
+ public QuickClone(Globals globals, Init init, QuickFetch fetch) : base(globals, fetch, init)
+ {
+ }
+ }
+}
View
32 GitTfs/Commands/QuickFetch.cs
@@ -1,16 +1,16 @@
-using Sep.Git.Tfs.Core;
-
-namespace Sep.Git.Tfs.Commands
-{
- public class QuickFetch : Fetch
- {
- public QuickFetch(Globals globals, RemoteOptions remoteOptions, FcOptions fcOptions) : base(globals, remoteOptions, fcOptions)
- {
- }
-
- protected override void DoFetch(IGitTfsRemote remote)
- {
- remote.QuickFetch();
- }
- }
-}
+using Sep.Git.Tfs.Core;
+
+namespace Sep.Git.Tfs.Commands
+{
+ public class QuickFetch : Fetch
+ {
+ public QuickFetch(Globals globals, RemoteOptions remoteOptions, FcOptions fcOptions) : base(globals, remoteOptions, fcOptions)
+ {
+ }
+
+ protected override void DoFetch(IGitTfsRemote remote)
+ {
+ remote.QuickFetch();
+ }
+ }
+}
View
16 GitTfs/Core/GitRepository.cs
@@ -64,10 +64,10 @@ public IGitTfsRemote ReadTfsRemote(string tfsUrl, string tfsRepositoryPath)
{
try
{
- var allRemotes = GetTfsRemotes();
- return
- allRemotes.Values.First(
- remote => remote.Tfs.MatchesUrl(tfsUrl) && remote.TfsRepositoryPath == tfsRepositoryPath);
+ var allRemotes = GetTfsRemotes();
+ return
+ allRemotes.Values.First(
+ remote => remote.Tfs.MatchesUrl(tfsUrl) && remote.TfsRepositoryPath == tfsRepositoryPath);
}
catch (Exception e)
{
@@ -119,8 +119,8 @@ private void SetRemoteConfigValue(IGitTfsRemote remote, string key, string value
case "url":
remote.Tfs.Url = value;
break;
- case "legacy-urls":
- remote.Tfs.LegacyUrls = value.Split(',');
+ case "legacy-urls":
+ remote.Tfs.LegacyUrls = value.Split(',');
break;
case "repository":
remote.TfsRepositoryPath = value;
@@ -258,8 +258,8 @@ public IEnumerable<IGitChangedFile> GetChangedFiles(string from, string to)
}
}
- private IGitChangedFile BuildGitChangedFile(GitChangeInfo change)
- {
+ private IGitChangedFile BuildGitChangedFile(GitChangeInfo change)
+ {
return change.ToGitChangedFile(_container.With((IGitRepository)this));
}
View
806 GitTfs/Core/GitTfsRemote.cs
@@ -1,403 +1,403 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Text.RegularExpressions;
-using Sep.Git.Tfs.Commands;
-using Sep.Git.Tfs.Core.TfsInterop;
-
-namespace Sep.Git.Tfs.Core
-{
- public class GitTfsRemote : IGitTfsRemote
- {
- private static readonly Regex isInDotGit = new Regex("(?:^|/)\\.git(?:/|$)");
- private static readonly Regex treeShaRegex = new Regex("^tree (" + GitTfsConstants.Sha1 + ")");
-
- private readonly Globals globals;
- private readonly TextWriter stdout;
- private readonly RemoteOptions remoteOptions;
- private long? maxChangesetId;
- private string maxCommitHash;
-
- public GitTfsRemote(RemoteOptions remoteOptions, Globals globals, ITfsHelper tfsHelper, TextWriter stdout)
- {
- this.remoteOptions = remoteOptions;
- this.globals = globals;
- this.stdout = stdout;
- Tfs = tfsHelper;
- }
-
- public string Id { get; set; }
- public string TfsRepositoryPath { get; set; }
- public string IgnoreRegexExpression { get; set; }
- public IGitRepository Repository { get; set; }
- public ITfsHelper Tfs { get; set; }
-
- public long MaxChangesetId
- {
- get { InitHistory(); return maxChangesetId.Value; }
- set { maxChangesetId = value; }
- }
-
- public string MaxCommitHash
- {
- get { InitHistory(); return maxCommitHash; }
- set { maxCommitHash = value; }
- }
-
- private void InitHistory()
- {
- if (maxChangesetId == null)
- {
- var mostRecentUpdate = Repository.GetParentTfsCommits(RemoteRef).FirstOrDefault();
- if (mostRecentUpdate != null)
- {
- MaxCommitHash = mostRecentUpdate.GitCommit;
- MaxChangesetId = mostRecentUpdate.ChangesetId;
- }
- else
- {
- MaxChangesetId = 0;
- }
- }
- }
-
- private string Dir
- {
- get
- {
- return Ext.CombinePaths(globals.GitDir, "tfs", Id);
- }
- }
-
- private string IndexFile
- {
- get
- {
- return Path.Combine(Dir, "index");
- }
- }
-
- private string WorkingDirectory
- {
- get
- {
- return Path.Combine(Dir, "workspace");
- }
- }
-
- public void CleanupWorkspace()
- {
- Tfs.CleanupWorkspaces(WorkingDirectory);
- }
-
- public bool ShouldSkip(string path)
- {
- return IsInDotGit(path) ||
- IsIgnored(path, IgnoreRegexExpression) ||
- IsIgnored(path, remoteOptions.IgnoreRegex);
- }
-
- private bool IsIgnored(string path, string expression)
- {
- return expression != null && new Regex(expression).IsMatch(path);
- }
-
- private bool IsInDotGit(string path)
- {
- return isInDotGit.IsMatch(path);
- }
-
- public string GetPathInGitRepo(string tfsPath)
- {
- if(!tfsPath.StartsWith(TfsRepositoryPath,StringComparison.InvariantCultureIgnoreCase)) return null;
- tfsPath = tfsPath.Substring(TfsRepositoryPath.Length);
- while (tfsPath.StartsWith("/"))
- tfsPath = tfsPath.Substring(1);
- return tfsPath;
- }
-
- public void Fetch(Dictionary<long, string> mergeInfo)
- {
- foreach (var changeset in FetchChangesets())
- {
- AssertTemporaryIndexClean(MaxCommitHash);
- var log = Apply(MaxCommitHash, changeset);
- if(mergeInfo.ContainsKey(changeset.Summary.ChangesetId))
- log.CommitParents.Add(mergeInfo[changeset.Summary.ChangesetId]);
- UpdateRef(Commit(log), changeset.Summary.ChangesetId);
- DoGcIfNeeded();
- }
- }
-
- public void QuickFetch()
- {
- var changeset = Tfs.GetLatestChangeset(this);
- AssertTemporaryIndexEmpty();
- var log = CopyTree(MaxCommitHash, changeset);
- UpdateRef(Commit(log), changeset.Summary.ChangesetId);
- DoGcIfNeeded();
- }
-
- private IEnumerable<ITfsChangeset> FetchChangesets()
- {
- Trace.WriteLine(RemoteRef + ": Getting changesets from " + (MaxChangesetId + 1) + " to current ...", "info");
- var changesets = Tfs.GetChangesets(TfsRepositoryPath, MaxChangesetId + 1, this);
- changesets = changesets.OrderBy(cs => cs.Summary.ChangesetId);
- return changesets;
- }
-
- private void UpdateRef(string commitHash, long changesetId)
- {
- MaxCommitHash = commitHash;
- MaxChangesetId = changesetId;
- Repository.CommandNoisy("update-ref", "-m", "C" + MaxChangesetId, RemoteRef, MaxCommitHash);
- Repository.CommandNoisy("update-ref", TagPrefix + "C" + MaxChangesetId, MaxCommitHash);
- LogCurrentMapping();
- }
-
- private void LogCurrentMapping()
- {
- stdout.WriteLine("C" + MaxChangesetId + " = " + MaxCommitHash);
- }
-
- private string TagPrefix
- {
- get { return "refs/tags/tfs/" + Id + "/"; }
- }
-
- public string RemoteRef
- {
- get { return "refs/remotes/tfs/" + Id; }
- }
-
- private void DoGcIfNeeded()
- {
- Trace.WriteLine("GC Countdown: " + globals.GcCountdown);
- if(--globals.GcCountdown < 0)
- {
- globals.GcCountdown = globals.GcPeriod;
- Repository.CommandNoisy("gc", "--auto");
- }
- }
-
- private void AssertTemporaryIndexClean(string treeish)
- {
- if(string.IsNullOrEmpty(treeish))
- {
- AssertTemporaryIndexEmpty();
- return;
- }
- WithTemporaryIndex(() => AssertIndexClean(treeish));
- }
-
- private void AssertTemporaryIndexEmpty()
- {
- if (File.Exists(IndexFile))
- File.Delete(IndexFile);
- }
-
- private void AssertIndexClean(string treeish)
- {
- if (!File.Exists(IndexFile)) Repository.CommandNoisy("read-tree", treeish);
- var currentTree = Repository.CommandOneline("write-tree");
- var expectedCommitInfo = Repository.Command("cat-file", "commit", treeish);
- var expectedCommitTree = treeShaRegex.Match(expectedCommitInfo).Groups[1].Value;
- if (expectedCommitTree != currentTree)
- {
- Trace.WriteLine("Index mismatch: " + expectedCommitTree + " != " + currentTree);
- Trace.WriteLine("rereading " + treeish);
- File.Delete(IndexFile);
- Repository.CommandNoisy("read-tree", treeish);
- currentTree = Repository.CommandOneline("write-tree");
- if (expectedCommitTree != currentTree)
- {
- throw new Exception("Unable to create a clean temporary index: trees (" + treeish + ") " + expectedCommitTree + " != " + currentTree);
- }
- }
- }
-
- private LogEntry Apply(string lastCommit, ITfsChangeset changeset)
- {
- LogEntry result = null;
- WithTemporaryIndex(
- () => GitIndexInfo.Do(Repository, index => result = changeset.Apply(lastCommit, index)));
- WithTemporaryIndex(
- () => result.Tree = Repository.CommandOneline("write-tree"));
- if(!String.IsNullOrEmpty(lastCommit)) result.CommitParents.Add(lastCommit);
- return result;
- }
-
- private LogEntry CopyTree(string lastCommit, ITfsChangeset changeset)
- {
- LogEntry result = null;
- WithTemporaryIndex(
- () => GitIndexInfo.Do(Repository, index => result = changeset.CopyTree(index)));
- WithTemporaryIndex(
- () => result.Tree = Repository.CommandOneline("write-tree"));
- if (!String.IsNullOrEmpty(lastCommit)) result.CommitParents.Add(lastCommit);
- return result;
- }
-
- private string Commit(LogEntry logEntry)
- {
- string commitHash = null;
- WithCommitHeaderEnv(logEntry, () => commitHash = WriteCommit(logEntry));
- // TODO (maybe): StoreChangesetMetadata(commitInfo);
- return commitHash;
- }
-
- private string WriteCommit(LogEntry logEntry)
- {
- // TODO (maybe): encode logEntry.Log according to 'git config --get i18n.commitencoding', if specified
- //var commitEncoding = Repository.CommandOneline("config", "i18n.commitencoding");
- //var encoding = LookupEncoding(commitEncoding) ?? Encoding.UTF8;
- string commitHash = null;
- Repository.CommandInputOutputPipe((procIn, procOut) =>
- {
- procIn.WriteLine(logEntry.Log);
- procIn.WriteLine(GitTfsConstants.TfsCommitInfoFormat, Tfs.Url,
- TfsRepositoryPath, logEntry.ChangesetId);
- procIn.Close();
- commitHash = ParseCommitInfo(procOut.ReadToEnd());
- }, BuildCommitCommand(logEntry));
- return commitHash;
- }
-
- private string[] BuildCommitCommand(LogEntry logEntry)
- {
- var tree = logEntry.Tree ?? GetTemporaryIndexTreeSha();
- tree.AssertValidSha();
- var commitCommand = new List<string> { "commit-tree", tree };
- foreach (var parent in logEntry.CommitParents)
- {
- commitCommand.Add("-p");
- commitCommand.Add(parent);
- }
- return commitCommand.ToArray();
- }
-
- private string GetTemporaryIndexTreeSha()
- {
- string tree = null;
- WithTemporaryIndex(() => tree = Repository.CommandOneline("write-tree"));
- return tree;
- }
-
- private string ParseCommitInfo(string commitTreeOutput)
- {
- return commitTreeOutput.Trim();
- }
-
- //private Encoding LookupEncoding(string encoding)
- //{
- // if(encoding == null)
- // return null;
- // throw new NotImplementedException("Need to implement encoding lookup for " + encoding);
- //}
-
- private void WithCommitHeaderEnv(LogEntry logEntry, Action action)
- {
- WithTemporaryEnvironment(action, new Dictionary<string, string>
- {
- {"GIT_AUTHOR_NAME", logEntry.AuthorName},
- {"GIT_AUTHOR_EMAIL", logEntry.AuthorEmail},
- {"GIT_AUTHOR_DATE", logEntry.Date.FormatForGit()},
- {"GIT_COMMITTER_DATE", logEntry.Date.FormatForGit()},
- {"GIT_COMMITTER_NAME", logEntry.CommitterName ?? logEntry.AuthorName},
- {"GIT_COMMITTER_EMAIL", logEntry.CommitterEmail ?? logEntry.AuthorEmail}
- });
- }
-
- private void WithTemporaryIndex(Action action)
- {
- WithTemporaryEnvironment(() =>
- {
- Directory.CreateDirectory(Path.GetDirectoryName(IndexFile));
- action();
- }, new Dictionary<string, string> {{"GIT_INDEX_FILE", IndexFile}});
- }
-
- private void WithTemporaryEnvironment(Action action, IDictionary<string, string> newEnvironment)
- {
- var oldEnvironment = new Dictionary<string, string>();
- PushEnvironment(newEnvironment, oldEnvironment);
- try
- {
- action();
- }
- finally
- {
- PushEnvironment(oldEnvironment);
- }
- }
-
- private void PushEnvironment(IDictionary<string, string> desiredEnvironment)
- {
- PushEnvironment(desiredEnvironment, new Dictionary<string, string>());
- }
-
- private void PushEnvironment(IDictionary<string, string> desiredEnvironment, IDictionary<string, string> oldEnvironment)
- {
- foreach(var key in desiredEnvironment.Keys)
- {
- oldEnvironment[key] = Environment.GetEnvironmentVariable(key);
- Environment.SetEnvironmentVariable(key, desiredEnvironment[key]);
- }
- }
-
- public void Shelve(string shelvesetName, string head, TfsChangesetInfo parentChangeset, bool evaluateCheckinPolicies)
- {
- Tfs.WithWorkspace(WorkingDirectory, this, parentChangeset,
- workspace => Shelve(shelvesetName, head, parentChangeset, evaluateCheckinPolicies, workspace));
- }
-
- public bool HasShelveset(string shelvesetName)
- {
- return Tfs.HasShelveset(shelvesetName);
- }
-
- private void Shelve(string shelvesetName, string head, TfsChangesetInfo parentChangeset, bool evaluateCheckinPolicies, ITfsWorkspace workspace)
- {
- PendChangesToWorkspace(head, parentChangeset, workspace);
- workspace.Shelve(shelvesetName, evaluateCheckinPolicies);
- }
-
- public long CheckinTool(string head, TfsChangesetInfo parentChangeset)
- {
- var changeset = 0L;
- Tfs.WithWorkspace(WorkingDirectory, this, parentChangeset,
- workspace => changeset = CheckinTool(head, parentChangeset, workspace));
- return changeset;
- }
-
- private long CheckinTool(string head, TfsChangesetInfo parentChangeset, ITfsWorkspace workspace)
- {
- PendChangesToWorkspace(head, parentChangeset, workspace);
- return workspace.CheckinTool();
- }
-
- private void PendChangesToWorkspace(string head, TfsChangesetInfo parentChangeset, ITfsWorkspace workspace)
- {
- foreach (var change in Repository.GetChangedFiles(parentChangeset.GitCommit, head))
- {
- change.Apply(workspace);
- }
- }
-
- public long Checkin(string head, TfsChangesetInfo parentChangeset)
- {
- var changeset = 0L;
- Tfs.WithWorkspace(WorkingDirectory, this, parentChangeset,
- workspace => changeset = Checkin(head, parentChangeset, workspace));
- return changeset;
- }
-
- private long Checkin(string head, TfsChangesetInfo parentChangeset, ITfsWorkspace workspace)
- {
- PendChangesToWorkspace(head, parentChangeset, workspace);
- return workspace.Checkin();
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text.RegularExpressions;
+using Sep.Git.Tfs.Commands;
+using Sep.Git.Tfs.Core.TfsInterop;
+
+namespace Sep.Git.Tfs.Core
+{
+ public class GitTfsRemote : IGitTfsRemote
+ {
+ private static readonly Regex isInDotGit = new Regex("(?:^|/)\\.git(?:/|$)");
+ private static readonly Regex treeShaRegex = new Regex("^tree (" + GitTfsConstants.Sha1 + ")");
+
+ private readonly Globals globals;
+ private readonly TextWriter stdout;
+ private readonly RemoteOptions remoteOptions;
+ private long? maxChangesetId;
+ private string maxCommitHash;
+
+ public GitTfsRemote(RemoteOptions remoteOptions, Globals globals, ITfsHelper tfsHelper, TextWriter stdout)
+ {
+ this.remoteOptions = remoteOptions;
+ this.globals = globals;
+ this.stdout = stdout;
+ Tfs = tfsHelper;
+ }
+
+ public string Id { get; set; }
+ public string TfsRepositoryPath { get; set; }
+ public string IgnoreRegexExpression { get; set; }
+ public IGitRepository Repository { get; set; }
+ public ITfsHelper Tfs { get; set; }
+
+ public long MaxChangesetId
+ {
+ get { InitHistory(); return maxChangesetId.Value; }
+ set { maxChangesetId = value; }
+ }
+
+ public string MaxCommitHash
+ {
+ get { InitHistory(); return maxCommitHash; }
+ set { maxCommitHash = value; }
+ }
+
+ private void InitHistory()
+ {
+ if (maxChangesetId == null)
+ {
+ var mostRecentUpdate = Repository.GetParentTfsCommits(RemoteRef).FirstOrDefault();
+ if (mostRecentUpdate != null)
+ {
+ MaxCommitHash = mostRecentUpdate.GitCommit;
+ MaxChangesetId = mostRecentUpdate.ChangesetId;
+ }
+ else
+ {
+ MaxChangesetId = 0;
+ }
+ }