Beispiel #1
0
            public static void ShowLog(string path, int startRev, int endRev, bool waitForCompletion)
            {
                Process proc = new Process();

                proc.StartInfo.FileName = DetectPath_TortoiseProc();

                var args = new Arguments();

                args.AddArgument("/command:", "log");
                args.AddArgument("/path:", path);
                if (startRev >= 0)
                {
                    args.AddArgument("/startrev:", startRev.ToString());
                }
                if (endRev >= 0)
                {
                    args.AddArgument("/endrev:", endRev.ToString());
                }

                proc.StartInfo.Arguments = args.ToString();
                proc.Start();
                if (waitForCompletion)
                {
                    proc.WaitForExit();
                }
            }
Beispiel #2
0
            public override void DiffFiles(string baseFile, string newFile, string baseNiceName, string newNiceName)
            {
                if (baseFile == null)
                {
                    throw new ArgumentNullException("baseFile");
                }
                if (newFile == null)
                {
                    throw new ArgumentNullException("newFile");
                }

                Process proc = new Process();

                proc.StartInfo.FileName = _detectedPath;

                string baseFileContents;

                using (var reader = new StreamReader(baseFile))
                {
                    baseFileContents = reader.ReadToEnd();
                }
                string newFileContents;

                using (var reader = new StreamReader(newFile))
                {
                    newFileContents = reader.ReadToEnd();
                }

                var udiff = UnifiedDiff.GenerateUnifiedDiff(baseFileContents, newFileContents, baseNiceName, newNiceName);

                string udiffFilename = System.IO.Path.GetTempFileName();

                using (System.IO.StreamWriter sw = new System.IO.StreamWriter(udiffFilename))
                {
                    sw.Write(udiff);
                }

                var args = new Arguments();

                FileInfo udiffFI = StringToFileInfoAndTestExists(udiffFilename);

                args.AddArgument("/patchfile:", udiffFI.FullName);

                if ((baseNiceName != null) && (newNiceName != null))
                {
                    args.AddArgument("/title:", string.Join(", ", new string[] { baseNiceName, newNiceName }));
                }
                else if (baseNiceName != null)
                {
                    args.AddArgument("/title:", string.Join(", ", new string[] { baseNiceName, newFile }));
                }
                else if (newNiceName != null)
                {
                    args.AddArgument("/title:", string.Join(", ", new string[] { baseFile, newNiceName }));
                }
                else
                {
                    args.AddArgument("/title:", string.Join(", ", new string[] { baseFile, newFile }));
                }

                proc.StartInfo.Arguments = args.ToString();

                proc.Start();

                proc.WaitForExit();

                File.Delete(udiffFilename);
            }