Esempio n. 1
0
        public override bool GetLatest(string path, ref string error, ref List <string> conflictsPaths)
        {
            if (client == null)
            {
                Init();
            }
            SvnUpdateResult result;

            try
            {
                RepositoryFolderBase repositoryFolderBase = WorkSpace.Instance.SolutionRepository.GetRepositoryFolderByPath(Path.GetDirectoryName(path));
                mConflictsPaths.Clear();
                repositoryFolderBase.PauseFileWatcher();
                client.Update(path, out result);
                repositoryFolderBase.ResumeFileWatcher();

                if (mConflictsPaths.Count > 0)
                {
                    conflictsPaths = mConflictsPaths;
                    return(false);
                }

                if (result.Revision != -1)
                {
                    if (supressMessage == true)
                    {
                        Reporter.ToLog(eLogLevel.DEBUG, "The solution was updated successfully to revision:  " + result.Revision);
                    }
                    else
                    {
                        Reporter.ToUser(eUserMsgKey.UpdateToRevision, result.Revision);
                    }
                }
                else
                {
                    if (supressMessage == true)
                    {
                        Reporter.ToLog(eLogLevel.ERROR, "Failed to update the solution from source control.Error Details: 'The files are not connected to source control'");
                    }
                    else
                    {
                        Reporter.ToUser(eUserMsgKey.SourceControlUpdateFailed, "The files are not connected to source control");
                    }
                }
            }
            catch (Exception ex)
            {
                client = null;
                error  = ex.Message + Environment.NewLine + ex.InnerException;
                return(false);
            }
            return(true);
        }
Esempio n. 2
0
        public static bool UpdateFile(SourceControlBase SourceControl, string path)
        {
            string error         = string.Empty;
            bool   IsFileUpdated = true;
            RepositoryFolderBase repositoryFolderBase = WorkSpace.Instance.SolutionRepository.GetRepositoryFolderByPath(Path.GetDirectoryName(path));

            repositoryFolderBase.PauseFileWatcher();
            if (!SourceControl.UpdateFile(path, ref error))
            {
                IsFileUpdated = false;
                Reporter.ToUser(eUserMsgKey.GeneralErrorOccured, error);
                return(IsFileUpdated);
            }
            repositoryFolderBase.ResumeFileWatcher();
            return(IsFileUpdated);
        }
        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);
            }
        }