Merge pull request #168 from vadimskipin/OverrideGatedBuild

Add support for OverrideGatedCheckIn
This commit is contained in:
Sean M. Collins
2012-04-10 13:03:41 -07:00
10 changed files with 87 additions and 26 deletions
+1
View File
@@ -75,6 +75,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TfsHelper.Vs11.cs" />
<Compile Include="TfsPlugin.cs" />
<Compile Include="Wrappers.Vs11.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GitTfs\GitTfs.csproj">
+23
View File
@@ -0,0 +1,23 @@
using System.Collections.Generic;
using Microsoft.TeamFoundation.VersionControl.Client;
using Sep.Git.Tfs.Core.TfsInterop;
namespace Sep.Git.Tfs.VsCommon
{
public partial class WrapperForWorkspace
{
public int Checkin(IPendingChange[] changes, string comment, ICheckinNote checkinNote, IEnumerable<IWorkItemCheckinInfo> workItemChanges,
TfsPolicyOverrideInfo policyOverrideInfo, bool overrideGatedCheckIn)
{
var checkinParameters = new WorkspaceCheckInParameters(_bridge.Unwrap<PendingChange>(changes), comment)
{
CheckinNotes = _bridge.Unwrap<CheckinNote>(checkinNote),
AssociatedWorkItems = _bridge.Unwrap<WorkItemCheckinInfo>(workItemChanges),
PolicyOverride = ToTfs(policyOverrideInfo),
OverrideGatedCheckIn = overrideGatedCheckIn
};
return _workspace.CheckIn(checkinParameters);
}
}
}
+7 -6
View File
@@ -123,6 +123,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TfsHelper.Vs2008.cs" />
<Compile Include="TfsPlugin.cs" />
<Compile Include="Wrappers.Vs2008.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GitTfs\GitTfs.csproj">
@@ -148,12 +149,12 @@
</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>
<!-- 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>
+20
View File
@@ -0,0 +1,20 @@
using System.Collections.Generic;
using Microsoft.TeamFoundation.VersionControl.Client;
using Sep.Git.Tfs.Core.TfsInterop;
namespace Sep.Git.Tfs.VsCommon
{
public partial class WrapperForWorkspace
{
public int Checkin(IPendingChange[] changes, string comment, ICheckinNote checkinNote, IEnumerable<IWorkItemCheckinInfo> workItemChanges,
TfsPolicyOverrideInfo policyOverrideInfo, bool overrideGatedCheckIn)
{
return _workspace.CheckIn(
_bridge.Unwrap<PendingChange>(changes),
comment,
_bridge.Unwrap<CheckinNote>(checkinNote),
_bridge.Unwrap<WorkItemCheckinInfo>(workItemChanges),
ToTfs(policyOverrideInfo));
}
}
}
+7 -6
View File
@@ -113,6 +113,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TfsHelper.Vs2010.cs" />
<Compile Include="TfsPlugin.cs" />
<Compile Include="Wrappers.Vs2010.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GitTfs\GitTfs.csproj">
@@ -138,12 +139,12 @@
</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>
<!-- 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>
+23
View File
@@ -0,0 +1,23 @@
using System.Collections.Generic;
using Microsoft.TeamFoundation.VersionControl.Client;
using Sep.Git.Tfs.Core.TfsInterop;
namespace Sep.Git.Tfs.VsCommon
{
public partial class WrapperForWorkspace
{
public int Checkin(IPendingChange[] changes, string comment, ICheckinNote checkinNote, IEnumerable<IWorkItemCheckinInfo> workItemChanges,
TfsPolicyOverrideInfo policyOverrideInfo, bool overrideGatedCheckIn)
{
var checkinParameters = new WorkspaceCheckInParameters(_bridge.Unwrap<PendingChange>(changes), comment)
{
CheckinNotes = _bridge.Unwrap<CheckinNote>(checkinNote),
AssociatedWorkItems = _bridge.Unwrap<WorkItemCheckinInfo>(workItemChanges),
PolicyOverride = ToTfs(policyOverrideInfo),
OverrideGatedCheckIn = overrideGatedCheckIn
};
return _workspace.CheckIn(checkinParameters);
}
}
}
+1 -12
View File
@@ -379,7 +379,7 @@ namespace Sep.Git.Tfs.VsCommon
}
}
public class WrapperForWorkspace : WrapperFor<Workspace>, IWorkspace
public partial class WrapperForWorkspace : WrapperFor<Workspace>, IWorkspace
{
private readonly TfsApiBridge _bridge;
private readonly Workspace _workspace;
@@ -400,17 +400,6 @@ namespace Sep.Git.Tfs.VsCommon
_workspace.Shelve(_bridge.Unwrap<Shelveset>(shelveset), _bridge.Unwrap<PendingChange>(changes), _bridge.Convert<ShelvingOptions>(options));
}
public int Checkin(IPendingChange[] changes, string comment, ICheckinNote checkinNote, IEnumerable<IWorkItemCheckinInfo> workItemChanges,
TfsPolicyOverrideInfo policyOverrideInfo)
{
return _workspace.CheckIn(
_bridge.Unwrap<PendingChange>(changes),
comment,
_bridge.Unwrap<CheckinNote>(checkinNote),
_bridge.Unwrap<WorkItemCheckinInfo>(workItemChanges),
ToTfs(policyOverrideInfo));
}
private PolicyOverrideInfo ToTfs(TfsPolicyOverrideInfo policyOverrideInfo)
{
if (policyOverrideInfo == null)
+3
View File
@@ -25,6 +25,8 @@ namespace Sep.Git.Tfs.Commands
{ "w|work-item=:", "Associated work items\ne.g. -w12345 to associate with 12345\nor -w12345:resolve to resolve 12345",
(n, opt) => { if(n == null) throw new OptionException("Missing work item number for option -w.", "-w");
(opt == "resolve" ? WorkItemsToResolve : WorkItemsToAssociate).Add(n); } },
{ "no-gate", "Disables gated checkin.",
v => { OverrideGatedCheckIn = true; } },
};
}
}
@@ -38,6 +40,7 @@ namespace Sep.Git.Tfs.Commands
public bool NoMerge { get; set; }
public string OverrideReason { get; set; }
public bool Force { get; set; }
public bool OverrideGatedCheckIn { get; set; }
public List<string> WorkItemsToAssociate { get { return _workItemsToAssociate; } }
public List<string> WorkItemsToResolve { get { return _workItemsToResolve; } }
}
+1 -1
View File
@@ -7,7 +7,7 @@ namespace Sep.Git.Tfs.Core.TfsInterop
IPendingChange[] GetPendingChanges();
ICheckinEvaluationResult EvaluateCheckin(TfsCheckinEvaluationOptions options, IPendingChange[] allChanges, IPendingChange[] changes, string comment, ICheckinNote checkinNote, IEnumerable<IWorkItemCheckinInfo> workItemChanges);
void Shelve(IShelveset shelveset, IPendingChange[] changes, TfsShelvingOptions options);
int Checkin(IPendingChange[] changes, string comment, ICheckinNote checkinNote, IEnumerable<IWorkItemCheckinInfo> workItemChanges, TfsPolicyOverrideInfo policyOverrideInfo);
int Checkin(IPendingChange[] changes, string comment, ICheckinNote checkinNote, IEnumerable<IWorkItemCheckinInfo> workItemChanges, TfsPolicyOverrideInfo policyOverrideInfo, bool overrideGatedCheckIn);
int PendAdd(string path);
int PendEdit(string path);
int PendDelete(string path);
+1 -1
View File
@@ -93,7 +93,7 @@ namespace Sep.Git.Tfs.Core
}
var policyOverride = GetPolicyOverrides(checkinProblems.Result);
var newChangeset = _workspace.Checkin(pendingChanges, _checkinOptions.CheckinComment, null, workItemInfos, policyOverride);
var newChangeset = _workspace.Checkin(pendingChanges, _checkinOptions.CheckinComment, null, workItemInfos, policyOverride, _checkinOptions.OverrideGatedCheckIn);
if(newChangeset == 0)
{
throw new GitTfsException("Checkin failed!");