private string GetStatus(SvnItem dirItem, ISvnProjectInfo projectInfo, string file) { if (dirItem == null || !dirItem.Exists || !dirItem.IsVersioned) return "<not found>"; if (projectInfo == null) { if (Scc.IsSolutionManaged) return "Connected"; // Solution itself + Connected else return "Not Connected"; } if (dirItem.IsBelowPath(SolutionSettings.ProjectRootSvnItem) && dirItem.WorkingCopy == SolutionSettings.ProjectRootSvnItem.WorkingCopy) { // In master working copy if (Scc.IsSolutionManaged && Scc.IsProjectManaged(_project)) return "Connected"; else return "Valid"; // In master working copy } else if (Scc.IsSolutionManaged && Scc.IsProjectManaged(_project)) return "Connected"; // Required information in solution else return "Detached"; // Separate working copy }
/// <summary> /// Returns false if the AddToSubversionDialog has been cancelled, true otherwise /// </summary> /// <param name="e"></param> /// <param name="projectInfo"></param> /// <param name="solutionReposRoot"></param> /// <param name="shouldMarkAsManaged"></param> /// <param name="storeReference"></param> /// <returns></returns> static bool CheckoutWorkingCopyForProject(CommandEventArgs e, ISvnProjectInfo projectInfo, Uri solutionReposRoot, out bool shouldMarkAsManaged, out bool storeReference) { shouldMarkAsManaged = false; storeReference = false; using (SvnClient cl = e.GetService<ISvnClientPool>().GetClient()) using (AddProjectToSubversion dialog = new AddProjectToSubversion()) { dialog.Context = e.Context; dialog.PathToAdd = projectInfo.ProjectDirectory; dialog.RepositoryAddUrl = solutionReposRoot; if (dialog.ShowDialog(e.Context) != DialogResult.OK) return false; // User cancelled the "Add to subversion" dialog, don't set as managed by Ankh Collection<SvnInfoEventArgs> info; SvnInfoArgs ia = new SvnInfoArgs(); ia.ThrowOnError = false; if (!cl.GetInfo(dialog.RepositoryAddUrl, ia, out info)) { // Target uri doesn't exist in the repository, let's create if (!RemoteCreateDirectory(e, dialog.Text, dialog.RepositoryAddUrl, cl)) return false; // Create failed; bail out } // Create working copy SvnCheckOutArgs coArg = new SvnCheckOutArgs(); coArg.AllowObstructions = true; cl.CheckOut(dialog.RepositoryAddUrl, dialog.WorkingCopyDir, coArg); shouldMarkAsManaged = dialog.MarkAsManaged; storeReference = dialog.WriteCheckOutInformation; } return true; }