public override void ResolveConflicts(string Path, eResolveConflictsSide side)
        {
            if (client == null)
            {
                Init();
            }
            try
            {
                CleanUp(Path);
                switch (side)
                {
                case eResolveConflictsSide.Local:
                    client.Resolve(Path, SvnAccept.Mine, new SvnResolveArgs {
                        Depth = SvnDepth.Infinity
                    });                                                                                        //keep local changes for all conflicts with server
                    client.Resolved(Path);
                    break;

                case eResolveConflictsSide.Server:
                    client.Resolve(Path, SvnAccept.Theirs, new SvnResolveArgs {
                        Depth = SvnDepth.Infinity
                    });                                                                                          //keep local changes for all conflicts with server
                    client.Resolved(Path);
                    break;
                }
            }
            catch (Exception e)
            {
            }
        }
Example #2
0
        private void ResolveSourceControlConflicts(eResolveConflictsSide side)
        {
            AutoLogProxy.UserOperationStart("ResolveConflictsBtn_Click");

            Reporter.ToGingerHelper(eGingerHelperMsgKey.ResolveSourceControlConflicts);
            SourceControlIntegration.ResolveConflicts(App.UserProfile.Solution.SourceControl, App.UserProfile.Solution.Folder, side);
            Reporter.CloseGingerHelper();

            AutoLogProxy.UserOperationEnd();
        }
Example #3
0
        private void ResolveSourceControlConflicts(eResolveConflictsSide side)
        {
            AutoLogProxy.UserOperationStart("ResolveConflictsBtn_Click");

            Reporter.ToStatus(eStatusMsgKey.ResolveSourceControlConflicts);
            SourceControlIntegration.ResolveConflicts(WorkSpace.UserProfile.Solution.SourceControl, WorkSpace.UserProfile.Solution.Folder, side);
            Reporter.HideStatusMessage();

            AutoLogProxy.UserOperationEnd();
        }
Example #4
0
        public override bool ResolveConflicts(string Path, eResolveConflictsSide side, ref string error)
        {
            if (client == null)
            {
                Init();
            }
            try
            {
                if (System.IO.Path.GetExtension(Path) != string.Empty && !System.IO.File.Exists(System.IO.Path.GetFullPath(Path.Replace(".xml", ".ignore"))))
                {
                    System.IO.File.Copy(Path, (System.IO.Path.GetFullPath(Path.Replace(".xml", ".ignore"))));
                }
                CleanUp(Path);
                switch (side)
                {
                case eResolveConflictsSide.Local:
                    client.Resolve(Path, SvnAccept.Mine, new SvnResolveArgs {
                        Depth = SvnDepth.Infinity
                    });                                                                                        //keep local changes for all conflicts with server
                    client.Resolved(Path);
                    break;

                case eResolveConflictsSide.Server:
                    client.Resolve(Path, SvnAccept.Theirs, new SvnResolveArgs {
                        Depth = SvnDepth.Infinity
                    });                                                                                          //keep local changes for all conflicts with server
                    client.Resolved(Path);
                    break;
                }

                string fileContent = File.ReadAllText(Path);
                if (fileContent.Contains("<<<<<<<"))
                {
                    Reporter.ToUser(eUserMsgKeys.SourceControlConflictResolveFailed, Path);
                }
            }
            catch (Exception e)
            {
                error = e.Message + Environment.NewLine + e.InnerException;
                return(false);
            }
            return(true);
        }
Example #5
0
 public override bool ResolveConflicts(string path, eResolveConflictsSide side, ref string error)
 {
     try
     {
         string ConflictsPathsError  = string.Empty;
         string ResolveConflictError = string.Empty;
         bool   result = true;
         if (path == SolutionFolder)
         {
             List <string> conflictPaths = GetConflictsPaths();
             foreach (string cp in conflictPaths)
             {
                 result = ResolveConflict(cp, side, ref ResolveConflictError);
                 if (!result)
                 {
                     error = error + ConflictsPathsError;
                 }
                 Stage(cp);
             }
         }
         else
         {
             result = ResolveConflict(path, side, ref ResolveConflictError);
             if (!result)
             {
                 error = error + ConflictsPathsError;
             }
             Stage(path);
         }
     }
     catch (Exception ex)
     {
         error = ex.Message + Environment.NewLine + ex.InnerException;
         return(false);
     }
     return(true);
 }
Example #6
0
        public static bool ResolveConflicts(SourceControlBase SourceControl, string path, eResolveConflictsSide side)
        {
            string error = string.Empty;

            if (!SourceControl.ResolveConflicts(path, side, ref error))
            {
                Reporter.ToUser(eUserMsgKey.GeneralErrorOccured, error);
                return(false);
            }

            return(true);
        }
Example #7
0
 //resolve conflicts automatically when getting latest updates
 public abstract bool ResolveConflicts(string path, eResolveConflictsSide side, ref string error);
Example #8
0
        public static bool ResolveConflicts(SourceControlBase SourceControl, string path, eResolveConflictsSide side)
        {
            string error = string.Empty;
            bool   IsConflictResolved = true;
            RepositoryFolderBase repositoryFolderBase = WorkSpace.Instance.SolutionRepository.GetRepositoryFolderByPath(Path.GetDirectoryName(path));

            repositoryFolderBase.PauseFileWatcher();
            if (!SourceControl.ResolveConflicts(path, side, ref error))
            {
                IsConflictResolved = false;
                Reporter.ToUser(eUserMsgKey.GeneralErrorOccured, error);
                return(IsConflictResolved);
            }
            repositoryFolderBase.ResumeFileWatcher();
            repositoryFolderBase.ReloadUpdatedXML(path);
            return(IsConflictResolved);
        }
 public override bool ResolveConflicts(string path, eResolveConflictsSide side, ref string error)
 {
     throw new NotImplementedException();
 }
Example #10
0
 private void ResolveSourceControlConflicts(eResolveConflictsSide side)
 {
     Reporter.ToStatus(eStatusMsgKey.ResolveSourceControlConflicts);
     SourceControlIntegration.ResolveConflicts(WorkSpace.Instance.Solution.SourceControl, WorkSpace.Instance.Solution.Folder, side);
     Reporter.HideStatusMessage();
 }
Example #11
0
        private bool ResolveConflict(string path, eResolveConflictsSide side, ref string error)
        {
            try
            {
                if (System.IO.Path.GetExtension(path) != string.Empty && !System.IO.File.Exists(path.Replace(".xml", ".ignore")))
                {
                    if (!System.IO.File.Exists(path.Replace(".xml", ".conflictBackup")))
                    {
                        System.IO.File.Copy(path, path.Replace(".xml", ".conflictBackup"));
                    }
                }

                string firstCommonResultText = string.Empty;
                string middleResultText      = string.Empty;
                string lastCommonResultText  = string.Empty;
                string fileContent           = string.Empty;
                if (side == eResolveConflictsSide.Local)
                {
                    fileContent = File.ReadAllText(path);

                    int startIndex = fileContent.IndexOf("<<<<<<< HEAD");
                    if (startIndex != 0)
                    {
                        firstCommonResultText = fileContent.Substring(0, startIndex);
                    }
                    int endIndex      = fileContent.IndexOf("=======");
                    int RequestLeanth = (endIndex - startIndex);
                    middleResultText = fileContent.Substring(startIndex + 14, RequestLeanth - 14);

                    startIndex           = fileContent.IndexOf(">>>>>>>");
                    lastCommonResultText = fileContent.Substring(startIndex);
                    startIndex           = lastCommonResultText.IndexOf("\r\n");
                    lastCommonResultText = lastCommonResultText.Substring(startIndex + 2);

                    File.WriteAllText(path, firstCommonResultText + middleResultText + lastCommonResultText);
                }
                else
                {
                    fileContent = File.ReadAllText(path);
                    int startIndex = fileContent.IndexOf("<<<<<<< HEAD");
                    if (startIndex != 0)
                    {
                        firstCommonResultText = fileContent.Substring(0, startIndex);
                    }

                    startIndex = fileContent.IndexOf("=======");
                    int endIndex      = fileContent.IndexOf(">>>>>>>");
                    int RequestLeanth = (endIndex - startIndex);
                    middleResultText = fileContent.Substring(startIndex + 9, RequestLeanth - 9);

                    startIndex           = fileContent.IndexOf(">>>>>>>");
                    lastCommonResultText = fileContent.Substring(startIndex);
                    startIndex           = lastCommonResultText.IndexOf("\r\n");
                    lastCommonResultText = lastCommonResultText.Substring(startIndex + 2);

                    File.WriteAllText(path, firstCommonResultText + middleResultText + lastCommonResultText);
                }

                if (File.ReadAllText(path).Contains("<<<<<<< HEAD"))
                {
                    return(ResolveConflict(path, side, ref error));
                }
            }
            catch (Exception ex)
            {
                error = ex.Message + Environment.NewLine + ex.InnerException;
                return(false);
            }
            return(true);
        }
        public static bool ResolveConflicts(SourceControlBase SourceControl, string path, eResolveConflictsSide side)
        {
            string error = string.Empty;
            bool   IsConflictResolved = true;

            try
            {
                if (path == null)
                {
                    return(false);
                }
                RepositoryFolderBase repositoryFolderBase = null;
                if (path != SourceControl.SolutionFolder)
                {
                    repositoryFolderBase = WorkSpace.Instance.SolutionRepository.GetRepositoryFolderByPath(Path.GetDirectoryName(path));
                    repositoryFolderBase.PauseFileWatcher();
                }

                if (!SourceControl.ResolveConflicts(path, side, ref error))
                {
                    IsConflictResolved = false;
                    Reporter.ToUser(eUserMsgKey.GeneralErrorOccured, error);
                    return(IsConflictResolved);
                }
                if (repositoryFolderBase != null)
                {
                    repositoryFolderBase.ResumeFileWatcher();
                    repositoryFolderBase.ReloadUpdatedXML(path);
                }

                return(IsConflictResolved);
            }
            catch (Exception ex)
            {
                Reporter.ToLog(eLogLevel.ERROR, "Error occured during resolving conflicts..", ex);
                return(false);
            }
        }