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); }
private void resolve_Click(object sender, EventArgs e) { Reporter.ToStatus(eStatusMsgKey.ResolveSourceControlConflicts); switch (mResolveOperation) { case eResolveOperations.AcceptServer: SourceControlIntegration.ResolveConflicts(WorkSpace.UserProfile.Solution.SourceControl, mConflictPath, eResolveConflictsSide.Server); break; case eResolveOperations.KeepLocal: SourceControlIntegration.ResolveConflicts(WorkSpace.UserProfile.Solution.SourceControl, mConflictPath, eResolveConflictsSide.Local); break; } Reporter.HideStatusMessage(); CloseWindow(); }
private void resolve_Click(object sender, EventArgs e) { Reporter.ToGingerHelper(eGingerHelperMsgKey.ResolveSourceControlConflicts); switch (mResolveOperation) { case eResolveOperations.AcceptServer: SourceControlIntegration.ResolveConflicts(App.UserProfile.Solution.SourceControl, mConflictPath, eResolveConflictsSide.Server); break; case eResolveOperations.KeepLocal: SourceControlIntegration.ResolveConflicts(App.UserProfile.Solution.SourceControl, mConflictPath, eResolveConflictsSide.Local); break; } Reporter.CloseGingerHelper(); CloseWindow(); }
private void Bind() { SourceControlClassTextBox.Text = SourceControlIntegration.GetSourceControlType(WorkSpace.Instance.Solution.SourceControl); SourceControlClassTextBox.IsReadOnly = true; SourceControlClassTextBox.IsEnabled = false; SourceControlURLTextBox.Text = SourceControlIntegration.GetRepositoryURL(WorkSpace.Instance.Solution.SourceControl); SourceControlURLTextBox.IsReadOnly = true; SourceControlURLTextBox.IsEnabled = false; GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(SourceControlUserTextBox, TextBox.TextProperty, WorkSpace.Instance.Solution.SourceControl, nameof(SourceControlBase.SourceControlUser)); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(SourceControlPassTextBox, TextBox.TextProperty, WorkSpace.Instance.Solution.SourceControl, nameof(SourceControlBase.SourceControlPass)); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xSourceControlBranchTextBox, TextBox.TextProperty, WorkSpace.Instance.Solution.SourceControl, nameof(SourceControlBase.SourceControlBranch)); if (SourceControlClassTextBox.Text == SourceControlBase.eSourceControlType.GIT.ToString()) { xTimeoutRow.Height = new GridLength(0); } else { GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xTextSourceControlConnectionTimeout, TextBox.TextProperty, WorkSpace.Instance.Solution.SourceControl, nameof(SourceControlBase.SourceControlTimeout)); xBranchRow.Height = new GridLength(0); } GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(SourceControlUserAuthorNameTextBox, TextBox.TextProperty, WorkSpace.Instance.Solution.SourceControl, nameof(SourceControlBase.SolutionSourceControlAuthorName)); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(SourceControlAuthorEmailTextBox, TextBox.TextProperty, WorkSpace.Instance.Solution.SourceControl, nameof(SourceControlBase.SolutionSourceControlAuthorEmail)); if (WorkSpace.Instance.Solution.SourceControl.IsSupportingLocks) { ShowIndicationkForLockedItems.Visibility = Visibility.Visible; } GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(ShowIndicationkForLockedItems, CheckBox.IsCheckedProperty, WorkSpace.Instance.Solution, nameof(Solution.ShowIndicationkForLockedItems)); SourceControlPassTextBox.Password = WorkSpace.Instance.Solution.SourceControl.SourceControlPass; SourceControlPassTextBox.PasswordChanged += SourceControlPassTextBox_PasswordChanged; if (String.IsNullOrEmpty(WorkSpace.Instance.Solution.SourceControl.SolutionSourceControlAuthorEmail)) { WorkSpace.Instance.Solution.SourceControl.SolutionSourceControlAuthorEmail = WorkSpace.Instance.Solution.SourceControl.SourceControlUser; } if (String.IsNullOrEmpty(WorkSpace.Instance.Solution.SourceControl.SolutionSourceControlAuthorName)) { WorkSpace.Instance.Solution.SourceControl.SolutionSourceControlAuthorName = WorkSpace.Instance.Solution.SourceControl.SourceControlUser; } }
private void Bind() { SourceControlClassTextBox.Text = SourceControlIntegration.GetSourceControlType(WorkSpace.UserProfile.Solution.SourceControl); SourceControlClassTextBox.IsReadOnly = true; SourceControlClassTextBox.IsEnabled = false; SourceControlURLTextBox.Text = SourceControlIntegration.GetRepositoryURL(WorkSpace.UserProfile.Solution.SourceControl); SourceControlURLTextBox.IsReadOnly = true; SourceControlURLTextBox.IsEnabled = false; App.ObjFieldBinding(SourceControlUserTextBox, TextBox.TextProperty, WorkSpace.UserProfile.Solution.SourceControl, nameof(SourceControlBase.SourceControlUser)); App.ObjFieldBinding(SourceControlPassTextBox, TextBox.TextProperty, WorkSpace.UserProfile.Solution.SourceControl, nameof(SourceControlBase.SourceControlPass)); if (SourceControlClassTextBox.Text == SourceControlBase.eSourceControlType.GIT.ToString()) { xTimeoutPanel.Visibility = Visibility.Hidden; } else { App.ObjFieldBinding(xTextSourceControlConnectionTimeout, TextBox.TextProperty, WorkSpace.UserProfile.Solution.SourceControl, nameof(SourceControlBase.SourceControlTimeout)); xTimeoutPanel.Visibility = Visibility.Visible; } App.ObjFieldBinding(SourceControlUserAuthorNameTextBox, TextBox.TextProperty, WorkSpace.UserProfile.Solution.SourceControl, nameof(SourceControlBase.SolutionSourceControlAuthorName)); App.ObjFieldBinding(SourceControlAuthorEmailTextBox, TextBox.TextProperty, WorkSpace.UserProfile.Solution.SourceControl, nameof(SourceControlBase.SolutionSourceControlAuthorEmail)); if (WorkSpace.UserProfile.Solution.SourceControl.IsSupportingLocks) { ShowIndicationkForLockedItems.Visibility = Visibility.Visible; } App.ObjFieldBinding(ShowIndicationkForLockedItems, CheckBox.IsCheckedProperty, WorkSpace.UserProfile.Solution, nameof(Solution.ShowIndicationkForLockedItems)); SourceControlPassTextBox.Password = WorkSpace.UserProfile.Solution.SourceControl.SourceControlPass; SourceControlPassTextBox.PasswordChanged += SourceControlPassTextBox_PasswordChanged; if (String.IsNullOrEmpty(WorkSpace.UserProfile.Solution.SourceControl.SolutionSourceControlAuthorEmail)) { WorkSpace.UserProfile.Solution.SourceControl.SolutionSourceControlAuthorEmail = WorkSpace.UserProfile.Solution.SourceControl.SourceControlUser; } if (String.IsNullOrEmpty(WorkSpace.UserProfile.Solution.SourceControl.SolutionSourceControlAuthorName)) { WorkSpace.UserProfile.Solution.SourceControl.SolutionSourceControlAuthorName = WorkSpace.UserProfile.Solution.SourceControl.SourceControlUser; } }
private void Init() { //ConnecitonDetailsPage Binding if (WorkSpace.Instance.UserProfile.SourceControlURL == null) { WorkSpace.Instance.UserProfile.SourceControlURL = ""; } SourceControlClassComboBox.Init(WorkSpace.Instance.UserProfile, nameof(UserProfile.SourceControlType), typeof(SourceControlBase.eSourceControlType), SourceControlClassComboBox_SelectionChanged); SourceControlClassComboBox.ComboBox.Items.RemoveAt(0);//removing the NONE option from user selection //ProjectPage Binding. if (IsImportSolution) { GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(SourceControlLocalFolderTextBox, TextBox.TextProperty, mSourceControl, nameof(SourceControlBase.SourceControlLocalFolderForGlobalSolution)); mSourceControl.SourceControlLocalFolderForGlobalSolution = @"C:\GingerSourceControl\GlobalCrossSolutions"; } else { GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(SourceControlLocalFolderTextBox, TextBox.TextProperty, mSourceControl, nameof(SourceControlBase.SourceControlLocalFolder)); } if (String.IsNullOrEmpty(WorkSpace.Instance.UserProfile.SourceControlLocalFolder)) { // Default local solutions folder mSourceControl.SourceControlLocalFolder = @"C:\GingerSourceControl\Solutions\"; } GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(ConfigureProxyCheckBox, CheckBox.IsCheckedProperty, mSourceControl, nameof(SourceControlBase.SourceControlConfigureProxy)); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(ProxyAddressTextBox, TextBox.TextProperty, mSourceControl, nameof(SourceControlBase.SourceControlProxyAddress)); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(ProxyPortTextBox, TextBox.TextProperty, mSourceControl, nameof(SourceControlBase.SourceControlProxyPort)); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(txtConnectionTimeout, TextBox.TextProperty, mSourceControl, nameof(SourceControlBase.SourceControlTimeout)); SolutionsGrid.btnRefresh.AddHandler(Button.ClickEvent, new RoutedEventHandler(RefreshGrid)); if (mSourceControl.GetSourceControlType == SourceControlBase.eSourceControlType.GIT) { xBranchesCombo.ItemsSource = SourceControlIntegration.GetBranches(mSourceControl); } GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xBranchesCombo, ComboBox.TextProperty, mSourceControl, nameof(SourceControlBase.SourceControlBranch)); }
internal static BitmapImage GetItemSourceControlImage(string FileName, ref SourceControlFileInfo.eRepositoryItemStatus ItemSourceControlStatus) { if (WorkSpace.UserProfile.Solution.SourceControl == null || FileName == null) { return(null); } SourceControlFileInfo.eRepositoryItemStatus RIS = SourceControlIntegration.GetFileStatus(WorkSpace.UserProfile.Solution.SourceControl, FileName, WorkSpace.UserProfile.Solution.ShowIndicationkForLockedItems); ItemSourceControlStatus = RIS; BitmapImage img = null; switch (RIS) { case SourceControlFileInfo.eRepositoryItemStatus.New: img = new BitmapImage(new Uri("pack://*****:*****@SourceControlItemAdded_10x10.png")); break; case SourceControlFileInfo.eRepositoryItemStatus.Modified: img = new BitmapImage(new Uri("pack://*****:*****@SourceControlItemChange_10x10.png")); break; case SourceControlFileInfo.eRepositoryItemStatus.Deleted: img = new BitmapImage(new Uri("pack://*****:*****@SourceControlItemDeleted_10x10.png")); break; case SourceControlFileInfo.eRepositoryItemStatus.Equel: img = new BitmapImage(new Uri("pack://*****:*****@SourceControlItemUnchanged_10x10.png")); break; case SourceControlFileInfo.eRepositoryItemStatus.LockedByAnotherUser: img = new BitmapImage(new Uri("pack://*****:*****@Lock_Red_10x10.png")); break; case SourceControlFileInfo.eRepositoryItemStatus.LockedByMe: img = new BitmapImage(new Uri("pack://*****:*****@Lock_Yellow_10x10.png")); break; } return(img); }
internal static eImageType GetFileImage(string path) { eImageType SCImage = eImageType.Null; if (WorkSpace.Instance.SourceControl == null) { return(SCImage); } SourceControlFileInfo.eRepositoryItemStatus RIS = SourceControlIntegration.GetFileStatus(WorkSpace.Instance.SourceControl, path, true); switch (RIS) { case SourceControlFileInfo.eRepositoryItemStatus.New: SCImage = eImageType.SourceControlNew; break; case SourceControlFileInfo.eRepositoryItemStatus.Modified: SCImage = eImageType.SourceControlModified; break; case SourceControlFileInfo.eRepositoryItemStatus.Deleted: SCImage = eImageType.SourceControlDeleted; break; case SourceControlFileInfo.eRepositoryItemStatus.Equel: SCImage = eImageType.SourceControlEquel; break; case SourceControlFileInfo.eRepositoryItemStatus.LockedByAnotherUser: SCImage = eImageType.SourceControlLockedByAnotherUser; break; case SourceControlFileInfo.eRepositoryItemStatus.LockedByMe: SCImage = eImageType.SourceControlLockedByMe; break; } return(SCImage); }
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); }
private void txtSourceControlConnectionTimeout_TextChanged(object sender, TextChangedEventArgs e) { SourceControlIntegration.Init(WorkSpace.Instance.Solution.SourceControl); WorkSpace.Instance.UserProfile.SolutionSourceControlTimeout = Int32.Parse(xTextSourceControlConnectionTimeout.Text); }
private void SourceControlPassTextBox_PasswordChanged(object sender, RoutedEventArgs e) { mSourceControl.SourceControlPass = ((PasswordBox)sender).Password; SourceControlIntegration.Init(mSourceControl); }
private async void CheckInButton_Click(object sender, RoutedEventArgs e) { try { xProcessingIcon.Visibility = Visibility.Visible; if (SourceControlIntegration.BusyInProcessWhileDownloading) { Reporter.ToUser(eUserMsgKeys.StaticInfoMessage, "Please wait for current process to end."); return; } SourceControlIntegration.BusyInProcessWhileDownloading = true; List <SourceControlFileInfo> SelectedFiles = mFiles.Where(x => x.Selected == true).ToList(); if (SelectedFiles == null || SelectedFiles.Count == 0) { Reporter.ToUser(eUserMsgKeys.SourceControlMissingSelectionToCheckIn); return; } if (CommentsTextBox.Text.Length == 0) { Reporter.ToUser(eUserMsgKeys.AskToAddCheckInComment); return; } if (Reporter.ToUser(eUserMsgKeys.SourceControlChkInConfirmtion, SelectedFiles.Count) == MessageBoxResult.No) { return; } string Comments = CommentsTextBox.Text.ToString(); // performing on the another thread await Task.Run(() => { App.MainWindow.Dispatcher.Invoke(() => { SaveAllDirtyFiles(SelectedFiles); }); //performing cleanup for the solution folder to clean old locks left by faild check ins SourceControlIntegration.CleanUp(App.UserProfile.Solution.SourceControl, App.UserProfile.Solution.Folder); List <string> pathsToCommit = new List <string>(); foreach (SourceControlFileInfo fi in SelectedFiles) { switch (fi.Status) { case SourceControlFileInfo.eRepositoryItemStatus.New: SourceControlIntegration.AddFile(App.UserProfile.Solution.SourceControl, fi.Path); pathsToCommit.Add(fi.Path); break; case SourceControlFileInfo.eRepositoryItemStatus.Modified: if (fi.Locked && fi.LockedOwner != App.UserProfile.Solution.SourceControl.SourceControlUser && Reporter.ToUser(eUserMsgKeys.SourceControlCheckInLockedByAnotherUser, fi.Path, fi.LockedOwner, fi.LockComment) == MessageBoxResult.Yes) { SourceControlIntegration.UpdateFile(App.UserProfile.Solution.SourceControl, fi.Path); pathsToCommit.Add(fi.Path); } else if (fi.Locked && fi.LockedOwner == App.UserProfile.Solution.SourceControl.SourceControlUser && Reporter.ToUser(eUserMsgKeys.SourceControlCheckInLockedByMe, fi.Path, fi.LockedOwner, fi.LockComment) == MessageBoxResult.Yes) { SourceControlIntegration.UpdateFile(App.UserProfile.Solution.SourceControl, fi.Path); pathsToCommit.Add(fi.Path); } else if (!fi.Locked) { SourceControlIntegration.UpdateFile(App.UserProfile.Solution.SourceControl, fi.Path); pathsToCommit.Add(fi.Path); } break; case SourceControlFileInfo.eRepositoryItemStatus.ModifiedAndResolved: pathsToCommit.Add(fi.Path); SourceControlIntegration.UpdateFile(App.UserProfile.Solution.SourceControl, fi.Path); break; case SourceControlFileInfo.eRepositoryItemStatus.Deleted: SourceControlIntegration.DeleteFile(App.UserProfile.Solution.SourceControl, fi.Path); pathsToCommit.Add(fi.Path); break; default: throw new Exception("Unknown file status to check-in - " + fi.Name); } } bool conflictHandled = false; bool CommitSuccess = false; CommitSuccess = SourceControlIntegration.CommitChanges(App.UserProfile.Solution.SourceControl, pathsToCommit, Comments, App.UserProfile.Solution.ShowIndicationkForLockedItems, ref conflictHandled); AfterCommitProcess(CommitSuccess, conflictHandled); TriggerSourceControlIconChanged(SelectedFiles); }); xProcessingIcon.Visibility = Visibility.Collapsed; if (SourceControlIntegration.conflictFlag) { SourceControlIntegration.conflictFlag = false; } } finally { xProcessingIcon.Visibility = Visibility.Collapsed; SourceControlIntegration.BusyInProcessWhileDownloading = false; } }
private async void Init() { try { xProcessingIcon.Visibility = Visibility.Visible; if (SourceControlIntegration.BusyInProcessWhileDownloading) { Reporter.ToUser(eUserMsgKeys.StaticInfoMessage, "Please wait for current process to end."); return; } SourceControlIntegration.BusyInProcessWhileDownloading = true; await Task.Run(() => { //set paths to ignore: List <string> pathsToIgnore = new List <string>(); pathsToIgnore.Add("PrevVersions"); pathsToIgnore.Add("RecentlyUsed.dat"); pathsToIgnore.Add("AutoSave"); pathsToIgnore.Add("Recover"); if (App.UserProfile.Solution != null && App.UserProfile.Solution.ExecutionLoggerConfigurationSetList != null && App.UserProfile.Solution.ExecutionLoggerConfigurationSetList.Count > 0) { pathsToIgnore.Add(Ginger.Run.ExecutionLogger.GetLoggerDirectory(App.UserProfile.Solution.ExecutionLoggerConfigurationSetList[0].ExecutionLoggerConfigurationExecResultsFolder)); } HTMLReportsConfiguration reportConfig = App.UserProfile.Solution.HTMLReportsConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault(); if (reportConfig != null) { pathsToIgnore.Add(Ginger.Reports.GingerExecutionReport.ExtensionMethods.GetReportDirectory(reportConfig.HTMLReportsFolder)); } mFiles = SourceControlIntegration.GetPathFilesStatus(App.UserProfile.Solution.SourceControl, mPath, pathsToIgnore); //set items name and type Parallel.ForEach(mFiles, SCFI => { try { if (SCFI.Path.ToUpper().Contains(".GINGER.") && SCFI.Path.ToUpper().Contains(".XML")) { NewRepositorySerializer newRepositorySerializer = new NewRepositorySerializer(); //unserialize the item RepositoryItemBase item = newRepositorySerializer.DeserializeFromFile(SCFI.Path); SCFI.Name = item.ItemName; } else { SCFI.Name = SCFI.Path.Substring(SCFI.Path.LastIndexOf('\\') + 1); } } catch (Exception ex) { if (SCFI.Path.Contains('\\') && (SCFI.Path.LastIndexOf('\\') + 1 < SCFI.Path.Length - 1)) { SCFI.Name = SCFI.Path.Substring(SCFI.Path.LastIndexOf('\\') + 1); } Reporter.ToLog(eAppReporterLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}", ex); } if (string.IsNullOrEmpty(SCFI.Path)) { SCFI.FileType = ""; } else if (SCFI.Path.ToUpper().Contains("AGENTS")) { SCFI.FileType = "Agent"; } else if (SCFI.Path.ToUpper().Contains("BUSINESSFLOWS")) { SCFI.FileType = GingerDicser.GetTermResValue(eTermResKey.BusinessFlow); } else if (SCFI.Path.ToUpper().Contains("DOCUMENTS")) { SCFI.FileType = "Document"; } else if (SCFI.Path.ToUpper().Contains("ENVIRONMENTS")) { SCFI.FileType = "Environment"; } else if (SCFI.Path.ToUpper().Contains("EXECUTIONRESULTS")) { SCFI.FileType = "Execution Result"; } else if (SCFI.Path.ToUpper().Contains("RUNSET")) { SCFI.FileType = GingerDicser.GetTermResValue(eTermResKey.RunSet); } else if (SCFI.Path.ToUpper().Contains("ACTIONS")) { SCFI.FileType = "Action"; } else if (SCFI.Path.ToUpper().Contains("ACTIVITIESGROUPS")) { SCFI.FileType = GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup); } else if (SCFI.Path.ToUpper().Contains("ACTIVITIES")) { SCFI.FileType = GingerDicser.GetTermResValue(eTermResKey.Activity); } else if (SCFI.Path.ToUpper().Contains("VARIABLES")) { SCFI.FileType = GingerDicser.GetTermResValue(eTermResKey.Variable); } else if (SCFI.Path.ToUpper().Contains("REPORTTEMPLATE")) { SCFI.FileType = "Report Template"; } else if (SCFI.Path.Contains("ApplicationAPIModel")) { SCFI.FileType = "Application API Model"; } else if (SCFI.Path.Contains("GlobalAppModelParameter")) { SCFI.FileType = "Global Applications Model Parameter"; } }); }); CheckInFilesGrid.DataSourceList = mFiles; } finally { xProcessingIcon.Visibility = Visibility.Collapsed; SourceControlIntegration.BusyInProcessWhileDownloading = false; } }
public static void DownloadSolution(string SolutionFolder) { try { SourceControlBase mSourceControl; if (WorkSpace.Instance.UserProfile.SourceControlType == SourceControlBase.eSourceControlType.GIT) { mSourceControl = new GITSourceControl(); } else if (WorkSpace.Instance.UserProfile.SourceControlType == SourceControlBase.eSourceControlType.SVN) { mSourceControl = RepositoryItemHelper.RepositoryItemFactory.GetNewSVnRepo(); } else { mSourceControl = RepositoryItemHelper.RepositoryItemFactory.GetNewSVnRepo(); } 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.SolutionFolder = SolutionFolder; mSourceControl.SourceControlConfigureProxy = WorkSpace.Instance.UserProfile.SolutionSourceControlConfigureProxy; mSourceControl.SourceControlProxyAddress = WorkSpace.Instance.UserProfile.SolutionSourceControlProxyAddress; mSourceControl.SourceControlProxyPort = WorkSpace.Instance.UserProfile.SolutionSourceControlProxyPort; mSourceControl.SourceControlTimeout = WorkSpace.Instance.UserProfile.SolutionSourceControlTimeout; mSourceControl.supressMessage = true; } if (WorkSpace.Instance.UserProfile.SourceControlLocalFolder == string.Empty) { Reporter.ToUser(eUserMsgKey.SourceControlConnMissingLocalFolderInput); } if (SolutionFolder.EndsWith("\\")) { SolutionFolder = SolutionFolder.Substring(0, SolutionFolder.Length - 1); } SolutionInfo sol = new SolutionInfo(); sol.LocalFolder = SolutionFolder; if (WorkSpace.Instance.UserProfile.SourceControlType == SourceControlBase.eSourceControlType.SVN && Directory.Exists(PathHelper.GetLongPath(sol.LocalFolder))) { sol.ExistInLocaly = true; } else if (WorkSpace.Instance.UserProfile.SourceControlType == SourceControlBase.eSourceControlType.GIT && Directory.Exists(PathHelper.GetLongPath(sol.LocalFolder + Path.DirectorySeparatorChar + @".git"))) { sol.ExistInLocaly = true; } else { sol.ExistInLocaly = false; } sol.SourceControlLocation = SolutionFolder.Substring(SolutionFolder.LastIndexOf(Path.DirectorySeparatorChar) + 1); if (sol == null) { Reporter.ToUser(eUserMsgKey.AskToSelectSolution); return; } string ProjectURI = string.Empty; if (WorkSpace.Instance.UserProfile.SourceControlType == SourceControlBase.eSourceControlType.SVN) { ProjectURI = WorkSpace.Instance.UserProfile.SourceControlURL.StartsWith("SVN", StringComparison.CurrentCultureIgnoreCase) ? sol.SourceControlLocation : WorkSpace.Instance.UserProfile.SourceControlURL + sol.SourceControlLocation; } else { ProjectURI = WorkSpace.Instance.UserProfile.SourceControlURL; } bool getProjectResult = true; getProjectResult = SourceControlIntegration.CreateConfigFile(mSourceControl); if (getProjectResult != true) { return; } if (sol.ExistInLocaly == true) { mSourceControl.RepositoryRootFolder = sol.LocalFolder; RepositoryItemHelper.RepositoryItemFactory.GetLatest(sol.LocalFolder, mSourceControl); } else { getProjectResult = SourceControlIntegration.GetProject(mSourceControl, sol.LocalFolder, ProjectURI); } } catch (Exception e) { Reporter.ToConsole(eLogLevel.INFO, "Error Downloading solution "); Reporter.ToConsole(eLogLevel.INFO, e.Message); Reporter.ToConsole(eLogLevel.INFO, e.Source); } }
public static bool DownloadSolution(string SolutionFolder, bool undoSolutionLocalChanges = false) { try { SourceControlBase mSourceControl; if (WorkSpace.Instance.UserProfile.SourceControlType == SourceControlBase.eSourceControlType.GIT) { if (WorkSpace.Instance != null && WorkSpace.Instance.UserProfile != null && WorkSpace.Instance.UserProfile.SourceControlUseShellClient) { mSourceControl = new GitSourceControlShellWrapper(); } else { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { mSourceControl = new GITSourceControl(); } else { mSourceControl = new GitSourceControlShellWrapper(); } } } else if (WorkSpace.Instance.UserProfile.SourceControlType == SourceControlBase.eSourceControlType.SVN) { if (WorkSpace.Instance != null && WorkSpace.Instance.UserProfile != null && WorkSpace.Instance.UserProfile.SourceControlUseShellClient) { mSourceControl = new SVNSourceControlShellWrapper(); } else { mSourceControl = TargetFrameworkHelper.Helper.GetNewSVnRepo(); } } else { mSourceControl = TargetFrameworkHelper.Helper.GetNewSVnRepo(); } 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.IgnoreCertificate = WorkSpace.Instance.UserProfile.SourceControlIgnoreCertificate; mSourceControl.SolutionFolder = SolutionFolder; mSourceControl.SourceControlConfigureProxy = WorkSpace.Instance.UserProfile.SolutionSourceControlConfigureProxy; mSourceControl.SourceControlProxyAddress = WorkSpace.Instance.UserProfile.SolutionSourceControlProxyAddress; mSourceControl.SourceControlProxyPort = WorkSpace.Instance.UserProfile.SolutionSourceControlProxyPort; mSourceControl.SourceControlTimeout = WorkSpace.Instance.UserProfile.SolutionSourceControlTimeout; mSourceControl.supressMessage = true; mSourceControl.SourceControlBranch = WorkSpace.Instance.UserProfile.SolutionSourceControlBranch; } if (WorkSpace.Instance.UserProfile.SourceControlLocalFolder == string.Empty) { Reporter.ToUser(eUserMsgKey.SourceControlConnMissingLocalFolderInput); } if (SolutionFolder.EndsWith("\\")) { SolutionFolder = SolutionFolder.Substring(0, SolutionFolder.Length - 1); } SolutionInfo sol = new SolutionInfo(); sol.LocalFolder = SolutionFolder; if (WorkSpace.Instance.UserProfile.SourceControlType == SourceControlBase.eSourceControlType.SVN && Directory.Exists(PathHelper.GetLongPath(sol.LocalFolder + Path.DirectorySeparatorChar + @".svn"))) { sol.ExistInLocaly = true; } else if (WorkSpace.Instance.UserProfile.SourceControlType == SourceControlBase.eSourceControlType.GIT && Directory.Exists(PathHelper.GetLongPath(sol.LocalFolder + Path.DirectorySeparatorChar + @".git"))) { sol.ExistInLocaly = true; } else { sol.ExistInLocaly = false; } sol.SourceControlLocation = SolutionFolder.Substring(SolutionFolder.LastIndexOf(Path.DirectorySeparatorChar) + 1); if (sol == null) { Reporter.ToUser(eUserMsgKey.AskToSelectSolution); return(false); } string ProjectURI = string.Empty; if (WorkSpace.Instance.UserProfile.SourceControlType == SourceControlBase.eSourceControlType.SVN && !(mSourceControl is SVNSourceControlShellWrapper)) { if (WorkSpace.Instance.UserProfile.SourceControlURL.StartsWith("SVN", StringComparison.CurrentCultureIgnoreCase)) { ProjectURI = sol.SourceControlLocation; } else { if (WorkSpace.Instance.UserProfile.SourceControlURL.ToUpper().Contains(sol.SourceControlLocation.ToUpper())) { ProjectURI = WorkSpace.Instance.UserProfile.SourceControlURL; } else { ProjectURI = WorkSpace.Instance.UserProfile.SourceControlURL; if (!ProjectURI.ToUpper().Contains("/SVN") && !ProjectURI.ToUpper().Contains("/SVN/")) { if (!ProjectURI.ToUpper().EndsWith("/")) { ProjectURI += "/"; } ProjectURI += "svn/"; } if (!ProjectURI.ToUpper().EndsWith("/")) { ProjectURI += "/"; } ProjectURI += sol.SourceControlLocation; } //if(WorkSpace.Instance.GingerCLIMode==Amdocs.Ginger.CoreNET.RunLib.CLILib.eGingerCLIMode.run) //{ // ProjectURI = WorkSpace.Instance.UserProfile.SourceControlURL; //} //else //{ // ProjectURI= WorkSpace.Instance.UserProfile.SourceControlURL + sol.SourceControlLocation; //} } } else { ProjectURI = WorkSpace.Instance.UserProfile.SourceControlURL; } bool getProjectResult = true; getProjectResult = SourceControlIntegration.CreateConfigFile(mSourceControl); if (getProjectResult != true) { return(false); } if (sol.ExistInLocaly == true) { mSourceControl.RepositoryRootFolder = sol.LocalFolder; if (undoSolutionLocalChanges) { Reporter.ToLog(eLogLevel.INFO, "Reverting local Solution changes"); try { TargetFrameworkHelper.Helper.Revert(sol.LocalFolder, mSourceControl); } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, "Failed to revert local Solution changes, error: " + ex.Message); } } return(TargetFrameworkHelper.Helper.GetLatest(sol.LocalFolder, mSourceControl)); } else { return(getProjectResult = SourceControlIntegration.GetProject(mSourceControl, sol.LocalFolder, ProjectURI)); } } catch (Exception e) { Reporter.ToLog(eLogLevel.ERROR, "Error occurred while Downloading/Updating Solution from source control", e); return(false); } }
private async void GetProject_Click(object sender, RoutedEventArgs e) { try { xProcessingIcon.Visibility = Visibility.Visible; if (SourceControlIntegration.BusyInProcessWhileDownloading) { Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "Please wait for current process to end."); return; } SourceControlIntegration.BusyInProcessWhileDownloading = true; if (WorkSpace.Instance.UserProfile.SourceControlLocalFolder == string.Empty) { Reporter.ToUser(eUserMsgKey.SourceControlConnMissingLocalFolderInput); } SolutionInfo sol = (SolutionInfo)SolutionsGrid.grdMain.SelectedItem; if (sol == null) { Reporter.ToUser(eUserMsgKey.AskToSelectSolution); return; } string ProjectURI = string.Empty; if (WorkSpace.Instance.UserProfile.SourceControlType == SourceControlBase.eSourceControlType.SVN) { ProjectURI = WorkSpace.Instance.UserProfile.SourceControlURL.StartsWith("SVN", StringComparison.CurrentCultureIgnoreCase) ? sol.SourceControlLocation : WorkSpace.Instance.UserProfile.SourceControlURL + sol.SourceControlLocation; } else { ProjectURI = WorkSpace.Instance.UserProfile.SourceControlURL; } bool getProjectResult = await Task.Run(() => SourceControlIntegration.GetProject(mSourceControl, sol.LocalFolder, ProjectURI)); SourceControlIntegration.BusyInProcessWhileDownloading = false; GetProjetList(); Mouse.OverrideCursor = null; if (getProjectResult && (Reporter.ToUser(eUserMsgKey.DownloadedSolutionFromSourceControl, sol.LocalFolder) == Amdocs.Ginger.Common.eUserMsgSelection.Yes)) { OpenSolution(sol.LocalFolder, ProjectURI); if (WorkSpace.Instance.Solution != null && WorkSpace.Instance.Solution.SourceControl != null) { if (WorkSpace.Instance.Solution.SourceControl.SourceControlUser != WorkSpace.Instance.UserProfile.SourceControlUser || WorkSpace.Instance.Solution.SourceControl.SourceControlPass != WorkSpace.Instance.UserProfile.SourceControlPass) { WorkSpace.Instance.Solution.SourceControl.SourceControlUser = WorkSpace.Instance.UserProfile.SourceControlUser; WorkSpace.Instance.Solution.SourceControl.SourceControlPass = WorkSpace.Instance.UserProfile.SourceControlPass; WorkSpace.Instance.Solution.SourceControl.Disconnect(); } } genWin.Close(); } } finally { SourceControlIntegration.BusyInProcessWhileDownloading = false; xProcessingIcon.Visibility = Visibility.Collapsed; } }
private void SourceControlUserDetails_TextChanged(object sender, TextChangedEventArgs e) { SourceControlIntegration.Init(WorkSpace.Instance.Solution.SourceControl); }
private async Task GetProjetList() { try { if (!IsImportSolution) { downloadProjBtn.IsEnabled = false; } if (SolutionsGrid.DataSourceList != null) { SolutionsGrid.DataSourceList.Clear(); } xProcessingIcon.Visibility = Visibility.Visible; if (SourceControlIntegration.BusyInProcessWhileDownloading) { Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "Please wait for current process to end."); return; } SourceControlIntegration.BusyInProcessWhileDownloading = true; SourceControlIntegration.CreateConfigFile(mSourceControl); if (SourceControlUI.TestConnection(mSourceControl, SourceControlConnDetailsPage.eSourceControlContext.DownloadProjectPage, true) == false) { SourceControlIntegration.BusyInProcessWhileDownloading = false; Mouse.OverrideCursor = null; return; } await Task.Run(() => SourceControlSolutions = SourceControlIntegration.GetProjectsList(mSourceControl) ); SolutionsGrid.DataSourceList = SourceControlSolutions; SolutionsGrid.grdMain.SelectedCellsChanged += GrdMain_SelectedCellsChanged; SolutionsGrid.grdMain.SelectedItem = SolutionsGrid.DataSourceList[0]; SetGridView(); Mouse.OverrideCursor = null; ConnectionConfigurationsExpender.IsExpanded = false; ConnectionDetailsExpender.IsExpanded = false; //Changed to save password only after successful Connect and search repositories WorkSpace.Instance.UserProfile.UserProfileOperations.SaveUserProfile(); } catch (Exception e) { Mouse.OverrideCursor = null; Reporter.ToUser(eUserMsgKey.FailedToGetProjectsListFromSVN, e.Message); } finally { xProcessingIcon.Visibility = Visibility.Collapsed; SourceControlIntegration.BusyInProcessWhileDownloading = false; if (SolutionsGrid.DataSourceList != null) { if (SolutionsGrid.DataSourceList.Count > 0) { if (!IsImportSolution) { downloadProjBtn.IsEnabled = true; } else { DownloadButton.Visibility = Visibility.Visible; } } } } }
private void SourceControlPassTextBox_PasswordChanged(object sender, RoutedEventArgs e) { mSourceControl.SourceControlPass = ((PasswordBox)sender).Password; WorkSpace.Instance.UserProfile.SaveUserProfile(); //todo: check if needed SourceControlIntegration.Init(mSourceControl); }
private void SourceControlUserDetails_TextChanged(object sender, TextChangedEventArgs e) { SourceControlIntegration.Init(App.UserProfile.Solution.SourceControl); }
private void SourceControlUserTextBox_TextChanged(object sender, TextChangedEventArgs e) { SourceControlIntegration.Init(mSourceControl); }
private async void Init() { try { xProcessingIcon.Visibility = Visibility.Visible; if (SourceControlIntegration.BusyInProcessWhileDownloading) { Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "Please wait for current process to end."); return; } SourceControlIntegration.BusyInProcessWhileDownloading = true; await Task.Run(() => { mFiles = SourceControlIntegration.GetPathFilesStatus(WorkSpace.Instance.Solution.SourceControl, mPath); //set items name and type Parallel.ForEach(mFiles, SCFI => { try { if (SCFI.Path.ToUpper().Contains(".GINGER.") && SCFI.Path.ToUpper().Contains(".XML") && SCFI.Status != SourceControlFileInfo.eRepositoryItemStatus.Deleted) { NewRepositorySerializer newRepositorySerializer = new NewRepositorySerializer(); //unserialize the item RepositoryItemBase item = newRepositorySerializer.DeserializeFromFile(SCFI.Path); SCFI.Name = item.ItemName; } else { SCFI.Name = SCFI.Path.Substring(SCFI.Path.LastIndexOf('\\') + 1); } } catch (Exception ex) { //TODO: fix the path changes if (SCFI.Path.Contains('\\') && (SCFI.Path.LastIndexOf('\\') + 1 < SCFI.Path.Length - 1)) { SCFI.Name = SCFI.Path.Substring(SCFI.Path.LastIndexOf('\\') + 1); } Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}", ex); } if (string.IsNullOrEmpty(SCFI.Path)) { SCFI.FileType = ""; } else if (SCFI.Path.ToUpper().Contains("AGENTS")) { SCFI.FileType = "Agent"; } else if (SCFI.Path.ToUpper().Contains("BUSINESSFLOWS")) { SCFI.FileType = GingerDicser.GetTermResValue(eTermResKey.BusinessFlow); } else if (SCFI.Path.ToUpper().Contains("DOCUMENTS")) { SCFI.FileType = "Document"; } else if (SCFI.Path.ToUpper().Contains("ENVIRONMENTS")) { SCFI.FileType = "Environment"; } else if (SCFI.Path.ToUpper().Contains("EXECUTIONRESULTS")) { SCFI.FileType = "Execution Result"; } else if (SCFI.Path.ToUpper().Contains("RUNSET")) { SCFI.FileType = GingerDicser.GetTermResValue(eTermResKey.RunSet); } else if (SCFI.Path.ToUpper().Contains("ACTIONS")) { SCFI.FileType = "Action"; } else if (SCFI.Path.ToUpper().Contains("ACTIVITIESGROUPS")) { SCFI.FileType = GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup); } else if (SCFI.Path.ToUpper().Contains("ACTIVITIES")) { SCFI.FileType = GingerDicser.GetTermResValue(eTermResKey.Activity); } else if (SCFI.Path.ToUpper().Contains("VARIABLES")) { SCFI.FileType = GingerDicser.GetTermResValue(eTermResKey.Variable); } else if (SCFI.Path.Contains("ApplicationAPIModel")) { SCFI.FileType = "Application API Model"; } else if (SCFI.Path.Contains("GlobalAppModelParameter")) { SCFI.FileType = "Global Applications Model Parameter"; } }); }); CheckInFilesGrid.DataSourceList = mFiles; } finally { xProcessingIcon.Visibility = Visibility.Collapsed; SourceControlIntegration.BusyInProcessWhileDownloading = false; } }