private static string[] GetRoots(IVsSolution solution) { return(GetProjectFiles(solution) .Where(x => !String.IsNullOrEmpty(x)) .Select(x => Path.GetDirectoryName(x)) .Select(x => HgPath.FindRepositoryRoot(x)) .Distinct() .ToArray()); }
public string GetBranch(string path) { var branch = ""; var root = HgPath.FindRepositoryRoot(path); lock (SyncRoot) { items.TryGetValue(root, out branch); } return(branch); }
private void OnAfterOpenProject(IVsHierarchy hierarchy) { var files = VisualHgSolution.GetProjectFiles(hierarchy); foreach (var root in files.Select(x => HgPath.FindRepositoryRoot(x)).Distinct()) { repository.UpdateRootStatus(root); } AddIf(VisualHgOptions.Global.AddFilesOnLoad, files); UpdateLastSeenProjectDirectory(hierarchy); }
public static void ShowDiffWindow(string fileName) { var root = HgPath.FindRepositoryRoot(fileName); var parent = GetOriginalFileName(fileName); var temp = Hg.CreateParentRevisionTempFile(parent, root); var revision = Hg.GetParentRevision(root) ?? "(parent revision)"; var tempName = GetDisplayName(parent, revision, root); var name = GetDisplayName(fileName, root); var diffTool = GetDiffTool(); diffTool.Exited += (s, e) => DeleteFile(temp); try { diffTool.Start(temp, fileName, tempName, name, root); } catch (InvalidOperationException) { MessageBox.Show(Resources.DiffToolNotFound + "\n\n" + diffTool.FileName, Resources.MessageBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public int GetHashCode(string s) { return (Comparer.GetHashCode(Path.GetFileName(s)) ^ Comparer.GetHashCode(HgPath.FindRepositoryRoot(s))); }