Skip to content

Commit

Permalink
ver 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mirik123 committed Dec 26, 2015
1 parent df69b05 commit d162d03
Show file tree
Hide file tree
Showing 12 changed files with 441 additions and 520 deletions.
11 changes: 4 additions & 7 deletions tfsprod/ExtendedMerge/MergeFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ static class MergeFactory
internal const int MergeTypeIndex = 6;
static internal MergeOptionsEx mergeOpt;
static internal bool bLinkWIs;
static internal bool AutomaticCheckin;

/// <summary>
/// Gets or sets the merge options enum, see <b>Microsoft.TeamFoundation.VersionControl.Common.MergeOptionsEx</b>.
Expand All @@ -36,11 +37,7 @@ static public MergeOptionsEx mergeOptions
/// <value>
/// <c>true</c> if [link work items]; otherwise, <c>false</c>.
/// </value>
static public bool LinkWorkItems
{
get { return bLinkWIs; }
set { bLinkWIs = value; }
}
static public bool LinkWorkItems;

static internal string FindCommonSharedPath(string[] str)
{
Expand Down Expand Up @@ -183,7 +180,7 @@ static internal void DoMerge(UserControl mfrm, IEnumerable<ListViewItem> lvcoll,
return;
}

if (wrkspc.GetPendingChanges().Length > 0)
if (AutomaticCheckin && wrkspc.GetPendingChanges().Length > 0)
{
MessageBox.Show("Please resolve all pending changes before going on.", Utilities.AppTitle);
return;
Expand Down Expand Up @@ -225,7 +222,7 @@ static internal void DoMerge(UserControl mfrm, IEnumerable<ListViewItem> lvcoll,
GetStatus sts = wrkspc.Merge((lvItem.Tag as ListViewItemTag).sourcePath, trg, chverspc, chverspc, LockLevel.Unchanged, RecursionType.Full, mergeType);
Utilities.OutputCommandString("Merge summary: MergeOptionsEx=" + mergeType + ", NoActionNeeded=" + sts.NoActionNeeded + ", NumFailures=" + sts.NumFailures + ", NumOperations=" + sts.NumOperations + ", NumUpdated=" + sts.NumUpdated + ", NumWarnings=" + sts.NumWarnings);

if (mergeOptions != MergeOptionsEx.NoMerge)
if (AutomaticCheckin)
{
while (wrkspc.QueryConflicts(ch.Changes.Select(x => x.Item.ServerItem).ToArray(), true).Length > 0)
{
Expand Down
183 changes: 47 additions & 136 deletions tfsprod/ExtendedMerge/MergeWIControl.Designer.cs

Large diffs are not rendered by default.

99 changes: 58 additions & 41 deletions tfsprod/ExtendedMerge/MergeWIControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,45 @@ private ListViewItemTag ClickedItem
public void Initialize()
{
MergeFactory.LinkWorkItems = this.toolLinkWIs.Checked;
MergeFactory.mergeOptions = (this.toolMAlwaysAcceptMine.Checked ? MergeOptionsEx.AlwaysAcceptMine : this.toolMConservative.Checked ? MergeOptionsEx.Conservative : this.toolMDiscard.Checked ? MergeOptionsEx.NoMerge : MergeOptionsEx.None);
MergeFactory.mergeOptions = this.toolMConservative.Checked ? MergeOptionsEx.Conservative : MergeOptionsEx.None;

this.toolMDiscard.Enabled = true;
this.toolMConservative.Enabled = true;
this.toolMNormal.Enabled = true;
this.toolLinkWIs.Enabled = true;
this.toolMAlwaysAcceptMine.Enabled = true;
this.toolMerge.Enabled = true;
this.toolRefresh.Enabled = true;
this.toolResolve.Enabled = true;
this.button1.Enabled = true;
this.toolMarkAllItems.Enabled = true;
this.toolUnmarkAllItems.Enabled = true;

var tableSettings = this.toolStrip1.LayoutSettings as TableLayoutSettings;
tableSettings.RowCount = 3;
tableSettings.ColumnCount = 8;

tableSettings.SetCellPosition(toolAutoCheckin, new TableLayoutPanelCellPosition(0, 0));
tableSettings.SetRowSpan(toolAutoCheckin, 3);

tableSettings.SetCellPosition(toolMNormal, new TableLayoutPanelCellPosition(1, 0));
tableSettings.SetCellPosition(toolMConservative, new TableLayoutPanelCellPosition(1, 1));
tableSettings.SetCellPosition(toolLinkWIs, new TableLayoutPanelCellPosition(1, 2));

tableSettings.SetCellPosition(toolMerge, new TableLayoutPanelCellPosition(2, 0));
tableSettings.SetRowSpan(toolMerge, 3);

tableSettings.SetCellPosition(toolResolve, new TableLayoutPanelCellPosition(3, 0));
tableSettings.SetRowSpan(toolResolve, 3);

tableSettings.SetCellPosition(toolDChangeset, new TableLayoutPanelCellPosition(4, 0));
tableSettings.SetRowSpan(toolDChangeset, 3);

tableSettings.SetCellPosition(toolDWorkItem, new TableLayoutPanelCellPosition(5, 0));
tableSettings.SetRowSpan(toolDWorkItem, 3);

tableSettings.SetCellPosition(toolRefresh, new TableLayoutPanelCellPosition(6, 0));
tableSettings.SetCellPosition(toolEditServerPath, new TableLayoutPanelCellPosition(6, 1));
tableSettings.SetCellPosition(toolDServerPath, new TableLayoutPanelCellPosition(6, 2));

tableSettings.SetCellPosition(toolDClipboard, new TableLayoutPanelCellPosition(7, 0));
tableSettings.SetCellPosition(toolGetRelBranches, new TableLayoutPanelCellPosition(7, 1));
}

/// <summary>
Expand Down Expand Up @@ -296,8 +322,24 @@ private void ctxMenuChangesets_ItemClicked(object sender, ToolStripItemClickedEv
private void listView1_ColumnClick(object sender, ColumnClickEventArgs e)
{
SuppressEvents = true;
listView1.Sorting = (listView1.Sorting == SortOrder.Ascending ? SortOrder.Descending : SortOrder.Ascending);
listView1.ListViewItemSorter = new MyListViewSorter(e.Column, listView1.Sorting);
if (e.Column == 0)
{
if (listView1.Columns[0].Text == '\u2714'.ToString())
{
listView1.Columns[0].Text = "";
foreach (ListViewItem item in listView1.Items) item.Checked = false;
}
else
{
listView1.Columns[0].Text = '\u2714'.ToString();
foreach (ListViewItem item in listView1.Items) item.Checked = true;
}
}
else
{
listView1.Sorting = (listView1.Sorting == SortOrder.Ascending ? SortOrder.Descending : SortOrder.Ascending);
listView1.ListViewItemSorter = new MyListViewSorter(e.Column, listView1.Sorting);
}
SuppressEvents = false;
}

Expand Down Expand Up @@ -330,11 +372,10 @@ private void toolRefresh_Click(object sender, EventArgs e)
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
private void toolMDiscard_Click(object sender, EventArgs e)
{
if (!toolMDiscard.Checked) return;
//if (!toolMDiscard.Checked) return;

MergeFactory.mergeOptions = MergeOptionsEx.NoMerge;

toolMAlwaysAcceptMine.Checked = false;
toolMConservative.Checked = false;
toolMNormal.Checked = false;
}
Expand All @@ -347,11 +388,10 @@ private void toolMDiscard_Click(object sender, EventArgs e)
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
private void toolMAlwaysAcceptMine_Click(object sender, EventArgs e)
{
if (!toolMAlwaysAcceptMine.Checked) return;
//if (!toolMAlwaysAcceptMine.Checked) return;

MergeFactory.mergeOptions = MergeOptionsEx.AlwaysAcceptMine;

toolMDiscard.Checked = false;
toolMConservative.Checked = false;
toolMNormal.Checked = false;
}
Expand All @@ -368,8 +408,6 @@ private void toolMConservative_Click(object sender, EventArgs e)

MergeFactory.mergeOptions = MergeOptionsEx.Conservative;

toolMDiscard.Checked = false;
toolMAlwaysAcceptMine.Checked = false;
toolMNormal.Checked = false;
}

Expand All @@ -385,8 +423,6 @@ private void toolMNormal_Click(object sender, EventArgs e)

MergeFactory.mergeOptions = MergeOptionsEx.None;

toolMDiscard.Checked = false;
toolMAlwaysAcceptMine.Checked = false;
toolMConservative.Checked = false;
}

Expand Down Expand Up @@ -481,32 +517,6 @@ private void listView1_SelectedIndexChanged(object sender, EventArgs e)
}
}

/// <summary>
/// Handles the Click event of the toolMarkAllItems control.
/// Changes state of all ListView items to checked.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
private void toolMarkAllItems_Click(object sender, EventArgs e)
{
SuppressEvents = true;
foreach (ListViewItem item in listView1.Items) item.Checked = true;
SuppressEvents = false;
}

/// <summary>
/// Handles the Click event of the toolUnmarkAllItems control.
/// hanges state of all ListView items to unchecked.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
private void toolUnmarkAllItems_Click(object sender, EventArgs e)
{
SuppressEvents = true;
foreach (ListViewItem item in listView1.Items) item.Checked = false;
SuppressEvents = false;
}

/// <summary>
/// Handles the Click event of the toolEditServerPath control.
/// Updates ListView column "Server Path" for selected items, see <see cref="EditServerPath"/>
Expand All @@ -531,5 +541,12 @@ private void toolGetRelBranches_Click(object sender, EventArgs e)

MessageBox.Show("Related branches for merge target path:" + Environment.NewLine + "---" + str1 + Environment.NewLine + "Related branches for merge source path:" + Environment.NewLine + "---" + str2, Utilities.AppTitle);
}

private void toolAutoCheckin_Click(object sender, EventArgs e)
{
MergeFactory.AutomaticCheckin = this.toolAutoCheckin.Checked;
if (!this.toolAutoCheckin.Checked)
MergeFactory.LinkWorkItems = this.toolLinkWIs.Checked = false;
}
}
}
Loading

0 comments on commit d162d03

Please sign in to comment.