Ejemplo n.º 1
0
 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());
 }
Ejemplo n.º 2
0
        public string GetBranch(string path)
        {
            var branch = "";
            var root   = HgPath.FindRepositoryRoot(path);

            lock (SyncRoot)
            {
                items.TryGetValue(root, out branch);
            }

            return(branch);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
 public int GetHashCode(string s)
 {
     return
         (Comparer.GetHashCode(Path.GetFileName(s)) ^
          Comparer.GetHashCode(HgPath.FindRepositoryRoot(s)));
 }