Skip to content

Commit 2ddd3bb

Browse files
committed
Built git-tfs plugin for Git Extensions
0 parents  commit 2ddd3bb

20 files changed

+4330
-0
lines changed

GitTfs.GitExtensions.Plugin.csproj

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{C964F29F-F5C9-4774-9977-FAA5791A7BAE}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>GitTfs.GitExtensions.Plugin</RootNamespace>
12+
<AssemblyName>GitTfs.Plugin</AssemblyName>
13+
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
14+
<FileAlignment>512</FileAlignment>
15+
<TargetFrameworkProfile />
16+
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<DebugType>pdbonly</DebugType>
28+
<Optimize>true</Optimize>
29+
<OutputPath>bin\Release\</OutputPath>
30+
<DefineConstants>TRACE</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
</PropertyGroup>
34+
<ItemGroup>
35+
<Reference Include="GitUIPluginInterfaces">
36+
<HintPath>..\lib\GitExtensions\GitUIPluginInterfaces.dll</HintPath>
37+
</Reference>
38+
<Reference Include="System" />
39+
<Reference Include="System.Data" />
40+
<Reference Include="System.Drawing" />
41+
<Reference Include="System.Windows.Forms" />
42+
<Reference Include="System.Xml" />
43+
</ItemGroup>
44+
<ItemGroup>
45+
<Compile Include="PullSetting.cs" />
46+
<Compile Include="SettingsContainer.cs" />
47+
<Compile Include="PushSetting.cs" />
48+
<Compile Include="ShelveSettingsContainer.cs" />
49+
<Compile Include="SettingKeys.cs" />
50+
<Compile Include="GitUICommandsExtensions.cs" />
51+
<Compile Include="GitTfsDialog.cs">
52+
<SubType>Form</SubType>
53+
</Compile>
54+
<Compile Include="GitTfsDialog.Designer.cs">
55+
<DependentUpon>GitTfsDialog.cs</DependentUpon>
56+
</Compile>
57+
<Compile Include="GitTfsPlugin.cs" />
58+
<Compile Include="Properties\AssemblyInfo.cs" />
59+
<Compile Include="Properties\Resources.Designer.cs">
60+
<AutoGen>True</AutoGen>
61+
<DesignTime>True</DesignTime>
62+
<DependentUpon>Resources.resx</DependentUpon>
63+
</Compile>
64+
<Compile Include="ShelveDialog.cs">
65+
<SubType>Form</SubType>
66+
</Compile>
67+
<Compile Include="ShelveDialog.Designer.cs">
68+
<DependentUpon>ShelveDialog.cs</DependentUpon>
69+
</Compile>
70+
</ItemGroup>
71+
<ItemGroup>
72+
<EmbeddedResource Include="GitTfsDialog.resx">
73+
<DependentUpon>GitTfsDialog.cs</DependentUpon>
74+
</EmbeddedResource>
75+
<EmbeddedResource Include="Properties\Resources.resx">
76+
<Generator>ResXFileCodeGenerator</Generator>
77+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
78+
</EmbeddedResource>
79+
<EmbeddedResource Include="ShelveDialog.resx">
80+
<DependentUpon>ShelveDialog.cs</DependentUpon>
81+
</EmbeddedResource>
82+
</ItemGroup>
83+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
84+
<PropertyGroup>
85+
<PostBuildEvent>
86+
</PostBuildEvent>
87+
</PropertyGroup>
88+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
89+
Other similar extension points exist, see Microsoft.Common.targets.
90+
<Target Name="BeforeBuild">
91+
</Target>
92+
<Target Name="AfterBuild">
93+
</Target>
94+
-->
95+
</Project>

GitTfsDialog.Designer.cs

Lines changed: 299 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

GitTfsDialog.cs

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Windows.Forms;
5+
using GitUIPluginInterfaces;
6+
7+
namespace GitTfs.GitExtensions.Plugin
8+
{
9+
public partial class GitTfsDialog : Form
10+
{
11+
private readonly IGitUICommands _commands;
12+
private readonly SettingsContainer _settings;
13+
14+
public GitTfsDialog(IGitUICommands commands, SettingsContainer settings, IEnumerable<string> tfsRemotes)
15+
{
16+
_commands = commands;
17+
_settings = settings;
18+
19+
InitializeComponent();
20+
TfsRemoteComboBox.DataSource = tfsRemotes.ToList();
21+
InitializeFromSettings();
22+
}
23+
24+
private void InitializeFromSettings()
25+
{
26+
InitializeTfsRemotes();
27+
InitializePull();
28+
InitializePush();
29+
}
30+
31+
private void InitializeTfsRemotes()
32+
{
33+
TfsRemoteComboBox.Text = _settings.TfsRemote;
34+
}
35+
36+
private void InitializePull()
37+
{
38+
switch(_settings.PullSetting)
39+
{
40+
case PullSetting.Pull:
41+
PullRadioButton.Checked = true;
42+
break;
43+
case PullSetting.Rebase:
44+
RebaseRadioButton.Checked = true;
45+
break;
46+
case PullSetting.Fetch:
47+
FetchRadioButton.Checked = true;
48+
break;
49+
}
50+
51+
SetPullButtonEnabledState();
52+
}
53+
54+
private void MergeOptionCheckedChanged(object sender, EventArgs e)
55+
{
56+
SetPullButtonEnabledState();
57+
}
58+
59+
private void SetPullButtonEnabledState()
60+
{
61+
PullButton.Enabled = PullRadioButton.Checked || RebaseRadioButton.Checked || FetchRadioButton.Checked;
62+
}
63+
64+
private void PullButtonClick(object sender, EventArgs e)
65+
{
66+
if (PullRadioButton.Checked)
67+
{
68+
_settings.PullSetting = PullSetting.Pull;
69+
if (!_commands.StartGitTfsCommandProcessDialog("pull"))
70+
{
71+
_commands.StartResolveConflictsDialog();
72+
}
73+
}
74+
else if (RebaseRadioButton.Checked)
75+
{
76+
_settings.PullSetting = PullSetting.Rebase;
77+
_commands.StartGitTfsCommandProcessDialog("fetch", TfsRemoteComboBox.Text);
78+
_commands.StartRebaseDialog("tfs/" + TfsRemoteComboBox.Text);
79+
}
80+
else if (FetchRadioButton.Checked)
81+
{
82+
_settings.PullSetting = PullSetting.Fetch;
83+
_commands.StartGitTfsCommandProcessDialog("fetch", TfsRemoteComboBox.Text);
84+
}
85+
}
86+
87+
private void InitializePush()
88+
{
89+
switch (_settings.PushSetting)
90+
{
91+
case PushSetting.Checkin:
92+
CheckinRadioButton.Checked = true;
93+
break;
94+
case PushSetting.Shelve:
95+
ShelveRadioButton.Checked = true;
96+
break;
97+
}
98+
99+
SetPushButtonEnabledState();
100+
}
101+
102+
private void PushOptionCheckedChanged(object sender, EventArgs e)
103+
{
104+
SetPushButtonEnabledState();
105+
}
106+
107+
private void SetPushButtonEnabledState()
108+
{
109+
PushButton.Enabled = CheckinRadioButton.Checked || ShelveRadioButton.Checked;
110+
}
111+
112+
private void PushButtonClick(object sender, EventArgs e)
113+
{
114+
if (CheckinRadioButton.Checked)
115+
{
116+
_settings.PushSetting = PushSetting.Checkin;
117+
_commands.StartGitTfsCommandProcessDialog("checkintool");
118+
}
119+
else if (ShelveRadioButton.Checked)
120+
{
121+
_settings.PushSetting = PushSetting.Shelve;
122+
new ShelveDialog(_commands, _settings.ShelveSettings).ShowDialog();
123+
}
124+
}
125+
126+
private void TfsRemoteComboBoxSelectedIndexChanged(object sender, EventArgs e)
127+
{
128+
_settings.TfsRemote = TfsRemoteComboBox.Text;
129+
}
130+
}
131+
}

0 commit comments

Comments
 (0)