public static void SourceControlInit()
        {
            if (App.UserProfile.SourceControlType == SourceControlBase.eSourceControlType.GIT)
            {
                mSourceControl = new GITSourceControl();
            }
            else if (App.UserProfile.SourceControlType == SourceControlBase.eSourceControlType.SVN)
            {
                mSourceControl = new SVNSourceControl();
            }
            else if (App.UserProfile.SourceControlType == SourceControlBase.eSourceControlType.None)
            {
                mSourceControl = new SVNSourceControl();
            }

            if (mSourceControl != null)
            {
                App.UserProfile.SourceControlType       = mSourceControl.GetSourceControlType;
                mSourceControl.SourceControlURL         = App.UserProfile.SourceControlURL;
                mSourceControl.SourceControlUser        = App.UserProfile.SourceControlUser;
                mSourceControl.SourceControlPass        = App.UserProfile.SourceControlPass;
                mSourceControl.SourceControlLocalFolder = App.UserProfile.SourceControlLocalFolder;

                mSourceControl.SourceControlConfigureProxy = App.UserProfile.SolutionSourceControlConfigureProxy;
                mSourceControl.SourceControlProxyAddress   = App.UserProfile.SolutionSourceControlProxyAddress;
                mSourceControl.SourceControlProxyPort      = App.UserProfile.SolutionSourceControlProxyPort;

                mSourceControl.PropertyChanged += SourceControl_PropertyChanged;
            }
        }
Example #2
0
        public void CloseSolution()
        {
            //Do cleanup
            if (SolutionRepository != null)
            {
                PlugInsManager.CloseAllRunningPluginProcesses();
                CloseAllRunningAgents();
                CloseAllEnvironments();
                SolutionRepository.StopAllRepositoryFolderWatchers();
                if (!RunningInExecutionMode)
                {
                    AppSolutionAutoSave.SolutionAutoSaveEnd();
                }
            }

            //Reset values
            if (!DoNotResetWorkspaceArgsOnClose)
            {
                mPluginsManager    = new PluginsManager();
                SolutionRepository = null;
                SourceControl      = null;
                Solution           = null;
            }

            EventHandler.SolutionClosed();
        }
Example #3
0
        public static bool TestConnection(SourceControlBase SourceControl, SourceControlConnDetailsPage.eSourceControlContext context, bool ignoreSuccessMessage)
        {
            string error = string.Empty;
            bool   res   = false;

            res = SourceControl.TestConnection(ref error);
            if (res)
            {
                if (!ignoreSuccessMessage)
                {
                    Reporter.ToUser(eUserMsgKey.SourceControlConnSucss);
                }
                return(true);
            }
            else
            {
                if (error.Contains("remote has never connected"))
                {
                    Reporter.ToUser(eUserMsgKey.SourceControlRemoteCannotBeAccessed, error);
                }
                else
                {
                    Reporter.ToUser(eUserMsgKey.SourceControlConnFaild, error);
                }
                return(false);
            }
        }
Example #4
0
        public static bool CommitSelfHealingChanges(string solutionPath)
        {
            SourceControlBase mSourceControl = WorkSpace.Instance.SourceControl;

            string error = string.Empty;
            var    sourceControlFileInfos = mSourceControl.GetPathFilesStatus(solutionPath, ref error);

            var paths = new List <string>();

            foreach (var item in sourceControlFileInfos)
            {
                if (item.Path.Contains("DOCUMENTS") || item.Path.Contains("EXECUTIONRESULTS"))
                {
                    continue;
                }
                if (item.Status == SourceControlFileInfo.eRepositoryItemStatus.Modified)
                {
                    paths.Add(item.Path);
                }
            }

            if (paths.Count == 0)
            {
                return(false);
            }

            List <string> conflictsPaths = new List <string>();

            return(mSourceControl.CommitChanges(paths, "check-in self healing changes.", ref error, ref conflictsPaths, false));
        }
Example #5
0
 public void CloseSolution()
 {
     SolutionRepository = null;
     // PlugInsManager = null;
     // GingerRunner = null;
     // CurrentEnvironment = null;
     SourceControl = null;
     EventHandler.SolutionClosed();
 }
Example #6
0
        public static bool UpdateFile(SourceControlBase SourceControl, string path)
        {
            string error = string.Empty;

            if (!SourceControl.UpdateFile(path, ref error))
            {
                Reporter.ToUser(eUserMsgKey.GeneralErrorOccured, error);
                return(false);
            }
            return(true);
        }
Example #7
0
        public static bool GetProject(SourceControlBase SourceControl, string Path, string URI)
        {
            string error = string.Empty;

            if (!SourceControl.GetProject(Path, URI, ref error))
            {
                Reporter.ToUser(eUserMsgKey.GeneralErrorOccured, error);
                return(false);
            }
            return(true);
        }
Example #8
0
        public static ObservableList <SourceControlFileInfo> GetPathFilesStatus(SourceControlBase SourceControl, string Path)
        {
            string error = string.Empty;
            ObservableList <SourceControlFileInfo> OL = SourceControl.GetPathFilesStatus(Path, ref error, WorkSpace.UserProfile.Solution.ShowIndicationkForLockedItems);

            if (error != string.Empty)
            {
                Reporter.ToUser(eUserMsgKey.GeneralErrorOccured, error);
            }
            return(OL);
        }
Example #9
0
        public static bool CreateConfigFile(SourceControlBase SourceControl)
        {
            string error = string.Empty;

            if (!SourceControl.CreateConfigFile(ref error))
            {
                Reporter.ToUser(eUserMsgKey.GeneralErrorOccured, error);
                return(false);
            }
            return(true);
        }
Example #10
0
 public static string GetCurrentBranchForSolution(SourceControlBase SourceControl)
 {
     try
     {
         return(SourceControl.GetCurrentBranchForSolution());
     }
     catch (Exception ex)
     {
         Reporter.ToLog(eLogLevel.ERROR, "Error occurred during Fetching Branches..", ex);
         return(null);
     }
 }
Example #11
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 #12
0
        internal static void Lock(SourceControlBase SourceControl, string path, string lockComment)
        {
            string error = string.Empty;

            if (!SourceControl.Lock(path, lockComment, ref error))
            {
                Reporter.ToUser(eUserMsgKey.GeneralErrorOccured, error);
            }
            else
            {
                Reporter.ToUser(eUserMsgKey.SourceControlLockSucss);
            }
        }
 public void GetSCType(string SourceControlURL, string SourceControlUser, string SourceControlPass, string SourceControlType)
 {
     if (SourceControlType == "SVN")
     {
         SourceControl = new SVNSourceControl();
     }
     else
     {
         SourceControl = new GITSourceControl();
     }
     SourceControl.SourceControlURL  = SourceControlURL;
     SourceControl.SourceControlUser = SourceControlUser;
     SourceControl.SourceControlPass = SourceControlPass;
 }
Example #14
0
        public static bool GetLatest(string path, SourceControlBase SourceControl)
        {
            string        error          = string.Empty;
            List <string> conflictsPaths = new List <string>();

            if (!SourceControl.GetLatest(path, ref error, ref conflictsPaths))
            {
                if (conflictsPaths.Count > 0)
                {
                    Reporter.ToUser(eUserMsgKey.SourceControlUpdateFailed, error);
                    return(false);
                }
            }
            return(true);
        }
Example #15
0
        public static bool CommitChanges(SourceControlBase SourceControl, ICollection <string> pathsToCommit, string Comments, bool includeLocks, ref bool conflictHandled)
        {
            string        error          = string.Empty;
            bool          result         = true;
            bool          conflict       = conflictHandled;
            List <string> conflictsPaths = new List <string>();

            if (!SourceControl.CommitChanges(pathsToCommit, Comments, ref error, ref conflictsPaths, includeLocks))
            {
                App.MainWindow.Dispatcher.Invoke(() => {
                    foreach (string cPath in conflictsPaths)
                    {
                        ResolveConflictPage resConfPage = new ResolveConflictPage(cPath);
                        if (WorkSpace.RunningInExecutionMode == true)
                        {
                            SourceControlIntegration.ResolveConflicts(WorkSpace.UserProfile.Solution.SourceControl, cPath, eResolveConflictsSide.Server);
                        }
                        else
                        {
                            resConfPage.ShowAsWindow();
                        }
                        result       = resConfPage.IsResolved;
                        conflict     = true;
                        conflictFlag = conflict;
                    }
                    if (SourceControl.GetSourceControlmConflict != null)
                    {
                        SourceControl.GetSourceControlmConflict.Clear();
                    }
                });
                if (!conflict)
                {
                    if (error.Contains("too many redirects or authentication replays"))
                    {
                        error = "Commit failed because of wrong credentials error, please enter valid Username and Password and try again";
                    }
                    if (error.Contains("is locked in another working copy"))
                    {
                        error = "This file has been locked by other user. Please remove lock and then try to Check in.";
                    }
                    App.MainWindow.Dispatcher.Invoke(() => {
                        Reporter.ToUser(eUserMsgKey.GeneralErrorOccured, error);
                    });
                    return(false);
                }
            }
            return(result);
        }
Example #16
0
        internal static void UnLock(SourceControlBase SourceControl, string path)
        {
            string error = string.Empty;

            if (!SourceControl.UnLock(path, ref error))
            {
                if (error != string.Empty)
                {
                    Reporter.ToUser(eUserMsgKey.GeneralErrorOccured, error);
                }
            }
            else
            {
                Reporter.ToUser(eUserMsgKey.SourceControlUnlockSucss);
            }
        }
Example #17
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 void SourceControlInit()
        {
            if (WorkSpace.Instance.UserProfile.SourceControlType == SourceControlBase.eSourceControlType.GIT)
            {
                mSourceControl = new GITSourceControl();
            }
            else if (WorkSpace.Instance.UserProfile.SourceControlType == SourceControlBase.eSourceControlType.SVN)
            {
                mSourceControl = new SVNSourceControl();
            }
            else if (WorkSpace.Instance.UserProfile.SourceControlType == SourceControlBase.eSourceControlType.None)
            {
                mSourceControl = new SVNSourceControl();
            }

            if (mSourceControl != null)
            {
                WorkSpace.Instance.UserProfile.SourceControlType = mSourceControl.GetSourceControlType;
                mSourceControl.SourceControlURL         = WorkSpace.Instance.UserProfile.SourceControlURL;
                mSourceControl.SourceControlUser        = WorkSpace.Instance.UserProfile.SourceControlUser;
                mSourceControl.SourceControlPass        = WorkSpace.Instance.UserProfile.SourceControlPass;
                mSourceControl.SourceControlLocalFolder = WorkSpace.Instance.UserProfile.SourceControlLocalFolder;
                mSourceControl.SourceControlBranch      = WorkSpace.Instance.UserProfile.SourceControlBranch;

                mSourceControl.SourceControlConfigureProxy = WorkSpace.Instance.UserProfile.SolutionSourceControlConfigureProxy;
                mSourceControl.SourceControlProxyAddress   = WorkSpace.Instance.UserProfile.SolutionSourceControlProxyAddress;
                mSourceControl.SourceControlProxyPort      = WorkSpace.Instance.UserProfile.SolutionSourceControlProxyPort;

                // If the UserProfile has been deleted or been created for the first time
                if (WorkSpace.Instance.UserProfile.SolutionSourceControlTimeout == 0)
                {
                    WorkSpace.Instance.UserProfile.SolutionSourceControlTimeout = 80;
                }
                mSourceControl.SourceControlTimeout = WorkSpace.Instance.UserProfile.SolutionSourceControlTimeout;
                mSourceControl.IsImportSolution     = IsImportSolution;

                mSourceControl.PropertyChanged += SourceControl_PropertyChanged;
            }
        }
        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);
            }
        }
Example #20
0
        public static bool GetLatest(string path, SourceControlBase SourceControl)
        {
            string        error           = string.Empty;
            List <string> conflictsPaths  = new List <string>();
            bool          result          = true;
            bool          conflictHandled = false;

            if (!SourceControl.GetLatest(path, ref error, ref conflictsPaths))
            {
                foreach (string cPath in conflictsPaths)
                {
                    ResolveConflictPage resConfPage = new ResolveConflictPage(cPath);
                    if (WorkSpace.RunningInExecutionMode == true)
                    {
                        SourceControlIntegration.ResolveConflicts(SourceControl, cPath, eResolveConflictsSide.Server);
                    }
                    else
                    {
                        resConfPage.ShowAsWindow();
                    }
                    result = resConfPage.IsResolved;

                    if (!result)
                    {
                        Reporter.ToUser(eUserMsgKey.SourceControlGetLatestConflictHandledFailed);
                        return(false);
                    }
                    conflictHandled = true;
                }
                if (!conflictHandled)
                {
                    Reporter.ToUser(eUserMsgKey.SourceControlUpdateFailed, error);
                    return(false);
                }
            }
            return(true);
        }
Example #21
0
        internal static SourceControlItemInfoDetails GetRepositoryInfo(SourceControlBase sourceControl)
        {
            string error = string.Empty;

            return(sourceControl.GetRepositoryInfo(ref error));
        }
Example #22
0
        public static SourceControlItemInfoDetails GetInfo(SourceControlBase SourceControl, string path)
        {
            string error = string.Empty;

            return(SourceControl.GetInfo(path, ref error));
        }
Example #23
0
        public static SourceControlFileInfo.eRepositoryItemStatus GetFileStatus(SourceControlBase SourceControl, string Path, bool ShowIndicationkForLockedItems)
        {
            string error = string.Empty;

            return(SourceControl.GetFileStatus(Path, ShowIndicationkForLockedItems, ref error));
        }
Example #24
0
        public static string GetRepositoryURL(SourceControlBase SourceControl)
        {
            string error = string.Empty;

            return(WorkSpace.UserProfile.Solution.SourceControl.GetRepositoryURL(ref error));
        }
Example #25
0
 public static ObservableList <SolutionInfo> GetProjectsList(SourceControlBase SourceControl)
 {
     return(SourceControl.GetProjectsList());
 }
Example #26
0
 public static bool Disconnect(SourceControlBase SourceControl)
 {
     SourceControl.Disconnect();
     return(true);
 }
Example #27
0
 public static bool CleanUp(SourceControlBase SourceControl, string folder)
 {
     SourceControl.CleanUp(folder);
     return(true);
 }
Example #28
0
        internal static string GetLockOwner(SourceControlBase SourceControl, string path)
        {
            string error = string.Empty;

            return(SourceControl.GetLockOwner(path, ref error));
        }
Example #29
0
 public static bool Init(SourceControlBase SourceControl)
 {
     SourceControl.Init();
     return(true);
 }
Example #30
0
 public static string GetSourceControlType(SourceControlBase SourceControl)
 {
     return(SourceControl.GetSourceControlType.ToString());
 }