Пример #1
0
        static void Resolve(CommandEventArgs e, SvnAccept accept)
        {
            HybridCollection <string> paths = new HybridCollection <string>(StringComparer.OrdinalIgnoreCase);

            foreach (SvnItem item in e.Selection.GetSelectedSvnItems(true))
            {
                if (!item.IsConflicted)
                {
                    continue;
                }

                if (!paths.Contains(item.FullPath))
                {
                    paths.Add(item.FullPath);
                }
            }


            IAnkhOpenDocumentTracker documentTracker = e.GetService <IAnkhOpenDocumentTracker>();

            documentTracker.SaveDocuments(paths); // Make sure all files are saved before updating/merging!

            using (DocumentLock lck = documentTracker.LockDocuments(paths, DocumentLockType.NoReload))
                using (lck.MonitorChangesForReload())
                    using (SvnClient client = e.GetService <ISvnClientPool>().GetNoUIClient())
                    {
                        SvnResolveArgs a = new SvnResolveArgs();
                        a.Depth = SvnDepth.Empty;

                        foreach (string p in paths)
                        {
                            client.Resolve(p, accept, a);
                        }
                    }
        }
Пример #2
0
 /// <summary>
 /// Handles the conflict based on the preferences.
 /// </summary>
 public void OnConflict(SvnConflictEventArgs args)
 {
     if (args.ConflictReason == SvnConflictReason.Edited)
     {
         SvnAccept choice = SvnAccept.Postpone;
         if (args.ConflictType == SvnConflictType.Property)
         {
             if (PromptOnPropertyConflict)
             {
                 HandleConflictWithDialog(args);
                 return;
             }
             else
             {
                 choice = PropertyConflictResolutionChoice;
             }
         }
         else if (args.IsBinary)
         {
             if (PromptOnBinaryConflict)
             {
                 HandleConflictWithDialog(args);
                 return;
             }
             else
             {
                 choice = BinaryConflictResolutionChoice;
             }
         }
         else
         {
             if (PromptOnTextConflict)
             {
                 if (UseExternalMergeTool())
                 {
                     HandleConflictWithExternalMergeTool(args);
                 }
                 else
                 {
                     HandleConflictWithDialog(args);
                 }
                 return;
             }
             else
             {
                 choice = TextConflictResolutionChoice;
             }
         }
         args.Choice = choice;
     }
     else
     {
         args.Choice = SvnAccept.Postpone;
     }
     AddToCurrentResolutions(args);
 }
Пример #3
0
        // BH: Note svn_wc_conflict_description_t is also mapped by SvnConflictData
        // for the non-event case
        internal SvnConflictEventArgs(svn_wc_conflict_description2_t description, AprPool pool)
        {
            if (description == null)
            {
                throw new ArgumentNullException(nameof(description));
            }
            if (pool == null)
            {
                throw new ArgumentNullException(nameof(pool));
            }

            _description = description;
            _pool        = pool;
            _result      = SvnAccept.Postpone;
        }
Пример #4
0
        private SvnAccept ToSvnAccept(MergeOptionsPage.ConflictResolutionOption option)
        {
            SvnAccept choice = SvnAccept.Postpone;

            switch (option)
            {
            case MergeOptionsPage.ConflictResolutionOption.BASE:
                choice = SvnAccept.Base;
                break;

            case MergeOptionsPage.ConflictResolutionOption.MINE:
                choice = SvnAccept.MineFull;
                break;

            case MergeOptionsPage.ConflictResolutionOption.THEIRS:
                choice = SvnAccept.TheirsFull;
                break;

            default:
                choice = SvnAccept.Postpone;
                break;
            }
            return(choice);
        }
Пример #5
0
 private void theirsRadioButton_CheckedChanged(object sender, EventArgs e)
 {
     this.ConflictResolution = SvnAccept.TheirsFull;
 }
Пример #6
0
 private void postponeRadioButton_CheckedChanged(object sender, EventArgs e)
 {
     this.ConflictResolution = SvnAccept.Postpone;
 }
Пример #7
0
 public MergeConflictHandler(IAnkhServiceProvider context, SvnAccept binaryChoice, SvnAccept textChoice)
     : this(context)
 {
     this._binaryChoice = binaryChoice;
     this._textChoice = textChoice;
 }
Пример #8
0
 public MergeConflictHandler(IAnkhServiceProvider context, SvnAccept binaryChoice, SvnAccept textChoice, SvnAccept propChoice)
     : this(context, binaryChoice, textChoice)
 {
 }
Пример #9
0
 public MergeConflictHandler(IAnkhServiceProvider context, SvnAccept binaryChoice, SvnAccept textChoice)
     : this(context)
 {
     this._binaryChoice = binaryChoice;
     this._textChoice = textChoice;
 }
Пример #10
0
 public MergeConflictHandler(IAnkhServiceProvider context, SvnAccept binaryChoice, SvnAccept textChoice, SvnAccept propChoice)
     : this(context, binaryChoice, textChoice)
 {
 }
Пример #11
0
        private void HandleConflictWithDialog(SvnConflictEventArgs e)
        {
            using (MergeConflictHandlerDialog dlg = new MergeConflictHandlerDialog(e))
            {
                if (dlg.ShowDialog(Context) == DialogResult.OK)
                {
                    e.Choice = dlg.ConflictResolution;
                    bool applyToAll = dlg.ApplyToAll;
                    // modify the preferences based on the conflicted file type
                    if (applyToAll)
                    {
                        PropertyConflictResolutionChoice = e.Choice;
                        PromptOnPropertyConflict = false;
                        BinaryConflictResolutionChoice = e.Choice;
                        PromptOnBinaryConflict = false;
                        TextConflictResolutionChoice = e.Choice;
                        PromptOnTextConflict = false;
                    }
                    else
                    {
                        bool applyToType = dlg.ApplyToType;
                        if (applyToType)
                        {
                            if (e.ConflictType == SvnConflictType.Property)
                            {
                                PropertyConflictResolutionChoice = e.Choice;
                                PromptOnPropertyConflict = false;
                            }
                            else if (e.IsBinary)
                            {
                                BinaryConflictResolutionChoice = e.Choice;
                                PromptOnBinaryConflict = false;
                            }
                            else
                            {
                                TextConflictResolutionChoice = e.Choice;
                                PromptOnTextConflict = false;
                            }
                        }
                    }
                    // TODO handle merged file option
                }
                else
                {
                    // Aborts the current operation.
                    e.Cancel = true;
                }
            }

            AddToCurrentResolutions(e);
        }
Пример #12
0
        static void Resolve(CommandEventArgs e, SvnAccept accept)
        {
            HybridCollection<string> paths = new HybridCollection<string>(StringComparer.OrdinalIgnoreCase);

            foreach (SvnItem item in e.Selection.GetSelectedSvnItems(true))
            {
                if (!item.IsConflicted)
                    continue;

                if (!paths.Contains(item.FullPath))
                    paths.Add(item.FullPath);
            }

            IAnkhOpenDocumentTracker documentTracker = e.GetService<IAnkhOpenDocumentTracker>();
            documentTracker.SaveDocuments(paths); // Make sure all files are saved before updating/merging!

            using (DocumentLock lck = documentTracker.LockDocuments(paths, DocumentLockType.NoReload))
            using (lck.MonitorChangesForReload())
            using (SvnClient client = e.GetService<ISvnClientPool>().GetNoUIClient())
            {
                SvnResolveArgs a = new SvnResolveArgs();
                a.Depth = SvnDepth.Empty;

                foreach (string p in paths)
                {
                    client.Resolve(p, accept, a);
                }
            }
        }