public MergeSolutionsForm(
                NodeDifference differenceInSourceBranch,
                NodeDifference differenceInDestinationBranch,
                Conflict conflict,
                OperationTypeConflictResolver operationTypeConflictResolver,
                ValueConflictResolver valueConflictResolver)
        {
            InitializeComponent();
            FormPosition.LoadFromRegistry(this);

            m_differencesInSourceBranchControl.Data = differenceInSourceBranch;
            m_differencesInDestinationBranchControl.Data = differenceInDestinationBranch;
            m_conflict = conflict as NodeConflict;
            m_operationTypeConflictResolver = operationTypeConflictResolver;
            m_valueConflictResolver = valueConflictResolver;
            if (m_conflict.Subconflicts.Count == 0)
            {
                m_result = (NodeDifference)m_conflict.Resolve(m_operationTypeConflictResolver, m_valueConflictResolver);
            }
            else
            {
                m_result = null;
            }

            UpdateUI();
        }
        public CompareSolutionsForm(NodeDifference difference)
        {
            InitializeComponent();
            FormPosition.LoadFromRegistry(this);

            m_differences.Data = difference;
        }
Example #3
0
        public CompareSolutionsForm(NodeDifference difference)
        {
            InitializeComponent();
            FormPosition.LoadFromRegistry(this);

            m_differences.Data = difference;
        }
        public MergeSolutionsForm(
            NodeDifference differenceInSourceBranch,
            NodeDifference differenceInDestinationBranch,
            Conflict conflict,
            OperationTypeConflictResolver operationTypeConflictResolver,
            ValueConflictResolver valueConflictResolver)
        {
            InitializeComponent();
            FormPosition.LoadFromRegistry(this);

            m_differencesInSourceBranchControl.Data      = differenceInSourceBranch;
            m_differencesInDestinationBranchControl.Data = differenceInDestinationBranch;
            m_conflict = conflict as NodeConflict;
            m_operationTypeConflictResolver = operationTypeConflictResolver;
            m_valueConflictResolver         = valueConflictResolver;
            if (m_conflict.Subconflicts.Count == 0)
            {
                m_result = (NodeDifference)m_conflict.Resolve(m_operationTypeConflictResolver, m_valueConflictResolver);
            }
            else
            {
                m_result = null;
            }

            UpdateUI();
        }
Example #5
0
        public static NodeConflict Merge(
            NodeElement commonAncestrorElement,
            NodeElement elementInSourceBranch,
            NodeElement elementInDestinationBranch,
            out NodeDifference differenceInSourceBranch,
            out NodeDifference differenceInDestinationBranch)
        {
            differenceInSourceBranch = (NodeDifference)elementInSourceBranch.CompareTo(commonAncestrorElement)
                                       ?? new NodeDifference(new ElementIdentifier("SolutionFile"), OperationOnParent.Modified, null);

            differenceInDestinationBranch = (NodeDifference)elementInDestinationBranch.CompareTo(commonAncestrorElement)
                                            ?? new NodeDifference(new ElementIdentifier("SolutionFile"), OperationOnParent.Modified, null);

            return((NodeConflict)differenceInSourceBranch.CompareTo(differenceInDestinationBranch));
        }
Example #6
0
        public static NodeConflict Merge(
                    NodeElement commonAncestrorElement,
                    NodeElement elementInSourceBranch,
                    NodeElement elementInDestinationBranch,
                    out NodeDifference differenceInSourceBranch,
                    out NodeDifference differenceInDestinationBranch)
        {
            differenceInSourceBranch = (NodeDifference) elementInSourceBranch.CompareTo(commonAncestrorElement)
                            ?? new NodeDifference(new ElementIdentifier("SolutionFile"), OperationOnParent.Modified, null);

            differenceInDestinationBranch = (NodeDifference) elementInDestinationBranch.CompareTo(commonAncestrorElement)
                            ?? new NodeDifference(new ElementIdentifier("SolutionFile"), OperationOnParent.Modified, null);

            return (NodeConflict)differenceInSourceBranch.CompareTo(differenceInDestinationBranch);
        }
Example #7
0
        private void FillDifferenceNode(TreeNode node, Difference difference)
        {
            node.Tag = difference;

            NodeDifference nodeDifference = difference as NodeDifference;

            if (nodeDifference != null)
            {
                foreach (Difference subdifference in nodeDifference.Subdifferences)
                {
                    TreeNode subnode = node.Nodes.Add(subdifference.ToString());
                    FillDifferenceNode(subnode, subdifference);
                }
            }
        }
        public UpdateOriginalSolutionForm(NodeDifference difference, string originalSolutionFullPath)
        {
            InitializeComponent();
            FormPosition.LoadFromRegistry(this);

            m_differencesInFilteredSolution.Data = difference;
            m_originalSolutionFullPath           = originalSolutionFullPath;
            UpdateState();

            m_watcher = new FileSystemWatcher();
            m_watcher.NotifyFilter = NotifyFilters.Attributes;
            m_watcher.Path         = Path.GetDirectoryName(originalSolutionFullPath);
            m_watcher.Filter       = Path.GetFileName(originalSolutionFullPath);
            m_watcher.Changed     += delegate(object source, FileSystemEventArgs e)
            {
                UpdateState();
            };
            m_watcher.EnableRaisingEvents = true;
        }
        public UpdateOriginalSolutionForm(NodeDifference difference, string originalSolutionFullPath)
        {
            InitializeComponent();
            FormPosition.LoadFromRegistry(this);

            m_differencesInFilteredSolution.Data = difference;
            m_originalSolutionFullPath = originalSolutionFullPath;
            UpdateState();

            m_watcher = new FileSystemWatcher();
            m_watcher.NotifyFilter = NotifyFilters.Attributes;
            m_watcher.Path = Path.GetDirectoryName(originalSolutionFullPath);
            m_watcher.Filter = Path.GetFileName(originalSolutionFullPath);
            m_watcher.Changed += delegate(object source, FileSystemEventArgs e)
                        {
                            UpdateState();
                        };
            m_watcher.EnableRaisingEvents = true;
        }
        /// <summary>
        /// Adds to the operations list all operations required to mutate
        /// <paramref name="originalNode"/> to the state* of
        /// <paramref name="newNode"/>.
        /// </summary>
        /// <param name="originalNode">The original node.</param>
        /// <param name="newNode">The new node.</param>
        /// <param name="ops">The operations list to add to.</param>
        /// <param name="idGenerator">The temporary ID generator for ADD operations.</param>
        /// <returns>The set of child product dimensions that require further
        /// processing.</returns>
        private void AddMutateOperations(ProductPartitionNode originalNode,
                                         ProductPartitionNode newNode, List <OperationPair> ops, TemporaryIdGenerator idGenerator)
        {
            NodeDifference nodeDifference = Diff(originalNode, newNode, dimensionComparator);
            bool           isProcessChildren;

            switch (nodeDifference)
            {
            case NodeDifference.NEW_NODE:
                ops.AddRange(CreateAddOperations(newNode, idGenerator));
                // No need to further process children. The ADD operations above will include operations
                // for all children of newNode.
                isProcessChildren = false;
                break;

            case NodeDifference.REMOVED_NODE:
                ops.Add(CreateRemoveOperation(originalNode));
                // No need to further process children. The REMOVE operation above will perform a
                // cascading delete of all children of newNode.
                isProcessChildren = false;
                break;

            case NodeDifference.PARTITION_TYPE_CHANGE:
            case NodeDifference.EXCLUDED_UNIT_CHANGE:
                ops.Add(CreateRemoveOperation(originalNode));
                ops.AddRange(CreateAddOperations(newNode, idGenerator));
                // No need to further process children. The ADD operations above will include operations
                // for all children of newNode.
                isProcessChildren = false;
                break;

            case NodeDifference.BID_CHANGE:
                // Ensure that the new node has the proper ID (this may have been lost if the node
                // was removed and then re-added).
                newNode.ProductPartitionId = originalNode.ProductPartitionId;
                ops.Add(CreateSetBidOperation(newNode));
                // Process the children of newNode. The SET operation above will only handle changes
                // made to newNode, not its children.
                isProcessChildren = true;
                break;

            case NodeDifference.NONE:
                // Ensure that the new node has the proper ID (this may have been lost if the node
                // was removed and then re-added).
                newNode.ProductPartitionId = originalNode.ProductPartitionId;
                // This node does not have changes, but its children may.
                isProcessChildren = true;
                break;

            default:
                throw new InvalidOperationException("Unrecognized difference: " + nodeDifference);
            }

            if (isProcessChildren)
            {
                // Try to match the children in new and original trees to identify the
                // matching dimensions.

                foreach (ProductPartitionNode newChild in newNode.Children)
                {
                    if (originalNode.HasChild(newChild.Dimension))
                    {
                        // this is probably an edit.
                        AddMutateOperations(originalNode.GetChild(newChild.Dimension), newChild, ops,
                                            idGenerator);
                    }
                    else
                    {
                        // this is a new node.
                        AddMutateOperations(null, newChild, ops, idGenerator);
                    }
                }

                foreach (ProductPartitionNode originalChild in originalNode.Children)
                {
                    if (newNode.HasChild(originalChild.Dimension))
                    {
                        // this is probably an edit. We dealt with it before
                        continue;
                    }
                    else
                    {
                        // this is a removed node.
                        AddMutateOperations(originalChild, null, ops, idGenerator);
                    }
                }
            }
        }
 private void m_buttonResolveAll_Click(object sender, EventArgs e)
 {
     m_result = (NodeDifference)m_conflict.Resolve(m_operationTypeConflictResolver, m_valueConflictResolver);
     UpdateUI();
 }
Example #12
0
 private void m_buttonResolveAll_Click(object sender, EventArgs e)
 {
     m_result = (NodeDifference)m_conflict.Resolve(m_operationTypeConflictResolver, m_valueConflictResolver);
     UpdateUI();
 }