Пример #1
0
 public static string GetHGTKFileName()
 {
     if (hgtkexe == null || hgtkexe == string.Empty)
     {
         hgtkexe = HG.GetTortoiseHGDirectory();
         if (hgtkexe != null && hgtkexe != string.Empty)
         {
             if (File.Exists(hgtkexe + "HGTK.exe"))
             {
                 hgtkexe += "HGTK.exe";
             }
             else if (File.Exists(hgtkexe + "THG.exe"))
             {
                 hgtkexe += "THG.exe";
             }
         }
     }
     return(hgtkexe);
 }
Пример #2
0
        // ------------------------------------------------------------------------
        // show TortoiseHG status dialog
        // ------------------------------------------------------------------------
        static public Process DiffDialog(string sccFile, string file, string commandMask)
        {
            String root = HGLib.HG.FindRootDirectory(file);

            if (root != String.Empty)
            {
                // copy latest file revision from repo temp folder
                string currentFile   = file;
                string versionedFile = Path.GetTempPath() + sccFile.Substring(sccFile.LastIndexOf("\\") + 1) + "(base)";

                // delete file if exists
                File.Delete(versionedFile);

                string cmd = "cat \"" + sccFile.Substring(root.Length + 1) + "\"  -o \"" + versionedFile + "\"";
                InvokeCommand(HG.GetHGFileName(), root, cmd);

                // wait file exists on disk
                int counter = 0;
                while (!File.Exists(versionedFile) && counter < 10)
                {
                    Thread.Sleep(100); ++counter;
                }

                // run diff tool
                if (commandMask != string.Empty)
                {
                    cmd = PrepareDiffCommand(versionedFile, currentFile, commandMask);
                    return(InvokeCommand(cmd, "", ""));
                }
                else
                {
                    commandMask = " \"$(Base)\" --fname \"$(BaseName)\" \"$(Mine)\" --fname \"$(MineName)\" ";
                    cmd         = PrepareDiffCommand(versionedFile, currentFile, commandMask);
                    return(InvokeCommand(HG.GetTortoiseHGDirectory() + "kdiff3.exe", root, cmd));
                }
            }
            return(null);
        }