예제 #1
0
        void MyShowChangesetEventHandler(object sender, ShowChangesetEventArgs args)
        {
            int changesetId                  = args.ChangesetId;
            VersionControlServer vcs         = args.VersionControlServer;
            ChangesetVersionSpec versionSpec = new ChangesetVersionSpec(changesetId);

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

            using (StreamWriter sw = new StreamWriter(tname))
            {
                DiffOptions options = new DiffOptions();
                options.UseThirdPartyTool      = false;
                options.Flags                  = DiffOptionFlags.EnablePreambleHandling;
                options.OutputType             = DiffOutputType.Unified;
                options.TargetEncoding         = Encoding.UTF8;
                options.SourceEncoding         = Encoding.UTF8;
                options.StreamWriter           = sw;
                options.StreamWriter.AutoFlush = true;

                DiffHelper.ShowChangeset(vcs, versionSpec, false, options);
            }

            Document d = MonoDevelop.Ide.Gui.IdeApp.Workbench.OpenDocument(tname, true);

            d.FileName = "Changeset " + changesetId.ToString();

            File.Delete(tname);
        }
예제 #2
0
    public override void Run()
    {
        Workspace workspace = GetWorkspaceFromCache();

        if (OptionOld || OptionModified)
        {
            ProcessOldAndModified(workspace);
            Environment.Exit((int)ExitCode.Success);
        }

        if (Arguments.Length > 0)
        {
            string arg = Arguments[0];
            if (!(File.Exists(arg) || Directory.Exists(arg)))
            {
                VersionSpec versionSpec = null;
                try
                {
                    versionSpec = VersionSpec.ParseSingleSpec(Arguments[0], OwnerFromString(OptionOwner));
                }
                catch (System.FormatException exception)
                {
                    Console.WriteLine("Invalid version specification: " + Arguments[0]);
                    Environment.Exit((int)ExitCode.Failure);
                }

                if (versionSpec is ChangesetVersionSpec)
                {
                    DiffHelper.ShowChangeset(VersionControlServer,
                                             versionSpec as ChangesetVersionSpec,
                                             OptionBrief, GetDiffOptions());
                }
                Environment.Exit((int)ExitCode.Success);
            }
        }

        List <string> paths;

        paths = VerifiedFullPaths(Arguments);
        if (paths.Count == 0)
        {
            paths.Add(Environment.CurrentDirectory);
        }
        ShowPendingChanges(workspace, paths.ToArray());
    }
예제 #3
0
        public void ShowChangeset(VersionControlServer vcs, int cid)
        {
            ChangesetVersionSpec versionSpec = new ChangesetVersionSpec(cid);

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

            using (StreamWriter sw = new StreamWriter(tname))
            {
                DiffHelper.ShowChangeset(vcs, versionSpec, false, GetDiffOptions(sw));
            }

            using (StreamReader sr = new StreamReader(tname))
            {
                textView.Update("temp.diff", sr.ReadToEnd());
            }

            File.Delete(tname);
        }
예제 #4
0
    public void UpdateCid(int cid)
    {
        ChangesetVersionSpec versionSpec = new ChangesetVersionSpec(cid);

        Toplevel.GdkWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Watch);

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

        using (StreamWriter sw = new StreamWriter(tname))
        {
            DiffHelper.ShowChangeset(driver.VersionControlServer, versionSpec,
                                     false, GetDiffOptions(sw));
        }

        using (StreamReader sr = new StreamReader(tname))
        {
            textView.Update("temp.diff", sr.ReadToEnd());
        }

        Toplevel.GdkWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.LeftPtr);
        File.Delete(tname);
    }