public override void Execute(MonoDevelop.Core.IProgressMonitor monitor, IBuildTarget item, ExecutionContext context, ConfigurationSelector configuration)
 {
     if (base.CanExecute(item, context, configuration))
     {
         // It is executable by default
         base.Execute(monitor, item, context, configuration);
         return;
     }
     else if (item is IWorkspaceObject)
     {
         UnitTest test = NUnitService.Instance.FindRootTest((IWorkspaceObject)item);
         if (test != null)
         {
             IAsyncOperation oper = null;
             DispatchService.GuiSyncDispatch(delegate
             {
                 oper = NUnitService.Instance.RunTest(test, context.ExecutionHandler, false);
             });
             if (oper != null)
             {
                 monitor.CancelRequested += delegate
                 {
                     oper.Cancel();
                 };
                 oper.WaitForCompleted();
             }
         }
     }
 }
        public override void Commit(ChangeSet changeSet, MonoDevelop.Core.IProgressMonitor monitor)
        {
            List <string> files       = new List <string> ();
            string        basePath    = MercurialRepository.GetLocalBasePath(changeSet.BaseLocalPath),
                          pyfiles     = string.Empty,
                          messageFile = Path.GetTempFileName();

            if (!basePath.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal))
            {
                basePath += Path.DirectorySeparatorChar;
            }

            foreach (ChangeSetItem item in changeSet.Items)
            {
                files.Add(string.Format("os.path.realpath('{0}')", item.LocalPath.FullPath));
            }

            if (!(0 == files.Count || (1 == files.Count && string.Empty.Equals(files[0], StringComparison.Ordinal))))
            {
                pyfiles = string.Format("{0},", string.Join(",", files.ToArray()));
            }

            try {
                File.WriteAllText(messageFile, changeSet.GlobalComment);
                RunMercurialRepoCommand(basePath, "commands.commit(repo.ui,repo,{1}logfile='{0}')", messageFile, pyfiles);
            } finally {
                try {
                    File.Delete(messageFile);
                } catch { }
            }
        }
Beispiel #3
0
 public override void Update(string localPath, bool recurse, MonoDevelop.Core.IProgressMonitor monitor)
 {
     try {
         client.Update(null);
     } catch (CommandException ce) {
         monitor.ReportError(ce.Message, ce);
     }
     monitor.ReportSuccess(string.Empty);
 }
Beispiel #4
0
 public override void Export(string localPath, string exportPath, MonoDevelop.Core.IProgressMonitor monitor)
 {
     try {
         client.Archive(NormalizePath(exportPath));
         monitor.ReportSuccess(string.Empty);
     } catch (CommandException ce) {
         monitor.ReportError(ce.Message, ce);
     }
 }
Beispiel #5
0
        public override void Resolve(string path, bool recurse, MonoDevelop.Core.IProgressMonitor monitor)
        {
            try {
                client.Resolve(new[] { path }, mark: true);
            } catch (CommandException ce) {
                monitor.ReportError(ce.Message, ce);
            }

            monitor.ReportSuccess(string.Empty);
        }
Beispiel #6
0
        public override void Commit(ChangeSet changeSet, MonoDevelop.Core.IProgressMonitor monitor)
        {
            try {
                client.Commit(changeSet.GlobalComment, changeSet.Items.Select(i => Path.Combine(changeSet.BaseLocalPath, i.LocalPath)).ToArray());
            } catch (CommandException ce) {
                monitor.ReportError(ce.Message, ce);
            }

            monitor.ReportSuccess(string.Empty);
        }
Beispiel #7
0
        internal static void Clone(string branchLocation, string localPath, MonoDevelop.Core.IProgressMonitor monitor)
        {
            try {
                CommandClient.Clone(source: branchLocation, destination: localPath, mercurialPath: DefaultMercurialPath);
            } catch (CommandException ce) {
                monitor.ReportError(ce.Message, ce);
            }

            monitor.ReportSuccess(string.Empty);
        }
Beispiel #8
0
        public override void Revert(string localPath, bool recurse, MonoDevelop.Core.IProgressMonitor monitor, MercurialRevision toRevision)
        {
            try {
                client.Revert(null, NormalizePath(localPath));
            } catch (CommandException ce) {
                monitor.ReportError(ce.Message, ce);
            }

            monitor.ReportSuccess(string.Empty);
        }
        public override void Update(string localPath, bool recurse, MonoDevelop.Core.IProgressMonitor monitor)
        {
            localPath = NormalizePath(Path.GetFullPath(localPath));
            if (null == monitor)
            {
                monitor = new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor();
            }
            string output = RunMercurialRepoCommand(localPath, "commands.update(repo.ui,repo)");

            monitor.Log.WriteLine(output);
        }
Beispiel #10
0
 public object ReadFile(FilePath file, Type expectedType, MonoDevelop.Core.IProgressMonitor monitor)
 {
     if (slnFileFormat.CanReadFile(file, this))
     {
         return(slnFileFormat.ReadFile(file, this, monitor));
     }
     else
     {
         return(MSBuildProjectService.LoadItem(monitor, file, null, null, null));
     }
 }
        }        // CanRebase

        public override void Rebase(string mergeLocation, string localPath, MonoDevelop.Core.IProgressMonitor monitor)
        {
            localPath = NormalizePath(Path.GetFullPath(localPath));
            if (null == monitor)
            {
                monitor = new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor();
            }
            string output = RunMercurialRepoCommand(localPath, "commands.pull(repo.ui,repo,'{0}',update=True,rebase=True)", mergeLocation);

            monitor.Log.WriteLine(output);
            monitor.Log.WriteLine("Rebased {0} onto {1}", localPath, mergeLocation);
        }        // Rebase
        }        // Bind

        public override void Unbind(string localPath, MonoDevelop.Core.IProgressMonitor monitor)
        {
            // Mercurial doesn't support bound branches yet (by default)

            /*
             * run (null, "b = branch.Branch.open_containing(url=ur'{0}')[0]\n", NormalizePath (localPath));
             * monitor.Log.WriteLine ("Opened {0}", localPath);
             *
             * run (null, "b.unbind()\n");
             * monitor.Log.WriteLine ("Unbound {0}", localPath);
             */
        }        // Unbind
Beispiel #13
0
        public override void Uncommit(string localPath, MonoDevelop.Core.IProgressMonitor monitor)
        {
            try {
                if (!client.Rollback())
                {
                    monitor.ReportWarning("Rollback failed");
                }
            } catch (CommandException ce) {
                monitor.ReportError(ce.Message, ce);
            }

            monitor.ReportSuccess(string.Empty);
        }
        public override void Branch(string branchLocation, string localPath, MonoDevelop.Core.IProgressMonitor monitor)
        {
            localPath = NormalizePath(localPath);
            if (null == monitor)
            {
                monitor = new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor();
            }

            string output = RunMercurialCommand("commands.clone(myui,'{0}','{1}')", branchLocation, localPath);

            monitor.Log.WriteLine(output);
            monitor.Log.WriteLine("Cloned to {0}", localPath);
        }
        }        // GetBoundBranch

        public override void Bind(string branchUrl, string localPath, MonoDevelop.Core.IProgressMonitor monitor)
        {
            // Mercurial doesn't support bound branches yet (by default)

            /*
             * run (null, "b = branch.Branch.open_containing(url=ur'{0}')[0]\n", localPath);
             * monitor.Log.WriteLine ("Opened {0}", NormalizePath (localPath));
             *
             * run (null, "remoteb = branch.Branch.open_containing(url=ur'{0}')[0]\n", branchUrl);
             * monitor.Log.WriteLine ("Opened {0}", branchUrl);
             *
             * run (null, "b.bind(other=remoteb)\n");
             * monitor.Log.WriteLine ("Bound {0} to {1}", localPath, branchUrl);
             */
        }        // Bind
        public override void Revert(string localPath, bool recurse, MonoDevelop.Core.IProgressMonitor monitor, MercurialRevision toRevision)
        {
            string rev = string.Empty;

            localPath = NormalizePath(localPath);
            if (null != toRevision && MercurialRevision.HEAD != toRevision.Rev && MercurialRevision.NONE != toRevision.Rev)
            {
                rev = string.Format(",rev='{0}',date=None", toRevision.Rev);
            }
            else
            {
                rev = ",rev='tip',date=None";
            }

            RunMercurialRepoCommand(localPath, "commands.revert(repo.ui,repo,os.path.realpath('{0}'){1})", localPath, rev);
        }
        }        // GetAnnotations

        public override void Export(string localPath, string exportPath, MonoDevelop.Core.IProgressMonitor monitor)
        {
            localPath  = NormalizePath(Path.GetFullPath(localPath));
            exportPath = NormalizePath(exportPath);
            if (!IsValidExportPath(exportPath))
            {
                throw new MercurialClientException(string.Format("Invalid export path: {0}", exportPath));
            }
            if (null == monitor)
            {
                monitor = new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor();
            }
            string output = RunMercurialRepoCommand(localPath, "commands.archive(repo.ui,repo,'{0}',prefix='')", exportPath);

            monitor.Log.WriteLine(output);
            monitor.Log.WriteLine("Exported to {0}", exportPath);
        }        // Export
Beispiel #18
0
 public void Save(MonoDevelop.Core.IProgressMonitor monitor)
 {
     if (HasSlnData && !SavingSolution && Item.ParentSolution != null)
     {
         // The project has data that has to be saved in the solution, but the solution is not being saved. Do it now.
         monitor.BeginTask(null, 2);
         SaveItem(monitor);
         monitor.Step(1);
         Solution sol = Item.ParentSolution;
         targetFormat.SlnFileFormat.WriteFile(sol.FileName, sol, targetFormat, false, monitor);
         sol.NeedsReload = false;
         monitor.EndTask();
     }
     else
     {
         SaveItem(monitor);
     }
 }
 public void WriteFile(FilePath file, object obj, MonoDevelop.Core.IProgressMonitor monitor)
 {
     if (slnFileFormat.CanWriteFile(obj, this))
     {
         slnFileFormat.WriteFile(file, obj, this, true, monitor);
     }
     else
     {
         SolutionEntityItem item = (SolutionEntityItem)obj;
         if (!(item.ItemHandler is MSBuildProjectHandler))
         {
             MSBuildProjectService.InitializeItemHandler(item);
         }
         MSBuildProjectHandler handler = (MSBuildProjectHandler)item.ItemHandler;
         handler.SetTargetFormat(this);
         handler.Save(monitor);
     }
 }
        public BuildResult RunTarget(MonoDevelop.Core.IProgressMonitor monitor, string target, ConfigurationSelector configuration)
        {
            if (target == ProjectService.BuildTarget)
            {
                target = "all";
            }
            else if (target == ProjectService.CleanTarget)
            {
                target = "clean";
            }

            DotNetProjectConfiguration conf = (DotNetProjectConfiguration)project.GetConfiguration(configuration);

            using (var output = new StringWriter()) {
                using (var tw = new LogTextWriter()) {
                    tw.ChainWriter(output);
                    tw.ChainWriter(monitor.Log);

                    using (ProcessWrapper proc = Runtime.ProcessService.StartProcess("make", "PROFILE=" + conf.Id + " " + target, conf.OutputDirectory, monitor.Log, tw, null))
                        proc.WaitForOutput();

                    tw.UnchainWriter(output);
                    tw.UnchainWriter(monitor.Log);

                    var result = new BuildResult(output.ToString(), 1, 0);

                    string[] lines = result.CompilerOutput.Split('\n');
                    foreach (string line in lines)
                    {
                        var err = CreateErrorFromString(line);
                        if (err != null)
                        {
                            result.Append(err);
                        }
                    }

                    return(result);
                }
            }
        }
Beispiel #21
0
        public BuildResult RunTarget(MonoDevelop.Core.IProgressMonitor monitor, string target, ConfigurationSelector configuration)
        {
            if (target == ProjectService.BuildTarget)
            {
                target = "all";
            }
            else if (target == ProjectService.CleanTarget)
            {
                target = "clean";
            }

            DotNetProjectConfiguration conf = (DotNetProjectConfiguration)project.GetConfiguration(configuration);

            StringWriter  output = new StringWriter();
            LogTextWriter tw     = new LogTextWriter();

            tw.ChainWriter(output);
            tw.ChainWriter(monitor.Log);

            ProcessWrapper proc = Runtime.ProcessService.StartProcess("make", "PROFILE=" + conf.Id + " " + target, conf.OutputDirectory, monitor.Log, tw, null);

            proc.WaitForOutput();

            CompilerResults cr = new CompilerResults(null);

            string[] lines = output.ToString().Split('\n');
            foreach (string line in lines)
            {
                CompilerError err = CreateErrorFromString(line);
                if (err != null)
                {
                    cr.Errors.Add(err);
                }
            }

            return(new BuildResult(cr, output.ToString()));
        }
Beispiel #22
0
 public BuildResult Compile(ProjectItemCollection items, DotNetProjectConfiguration configuration, ConfigurationSelector configSelector, MonoDevelop.Core.IProgressMonitor monitor)
 {
     return(new BuildResult("ok", 1, 0));
 }
 public abstract void DPush(string pushLocation, string localPath, bool remember, MonoDevelop.Core.IProgressMonitor monitor);
Beispiel #24
0
 protected override void OnCommit(ChangeSet changeSet, MonoDevelop.Core.IProgressMonitor monitor)
 {
     throw new NotImplementedException();
 }
 public abstract void Uncommit(string localPath, MonoDevelop.Core.IProgressMonitor monitor);
Beispiel #26
0
 protected override void OnCheckout(MonoDevelop.Core.FilePath targetLocalPath, Revision rev, bool recurse, MonoDevelop.Core.IProgressMonitor monitor)
 {
     throw new NotImplementedException();
 }
 protected override BuildResult OnBuild(MonoDevelop.Core.IProgressMonitor monitor, ConfigurationSelector configuration)
 {
     return(new BuildResult());
 }
Beispiel #28
0
 protected override void OnDeleteDirectories(MonoDevelop.Core.FilePath[] localPaths, bool force, MonoDevelop.Core.IProgressMonitor monitor, bool keepLocal)
 {
     throw new NotImplementedException();
 }
Beispiel #29
0
 protected override void OnAdd(MonoDevelop.Core.FilePath[] localPaths, bool recurse, MonoDevelop.Core.IProgressMonitor monitor)
 {
     throw new NotImplementedException();
 }
Beispiel #30
0
 protected override void OnRevertToRevision(MonoDevelop.Core.FilePath localPath, Revision revision, MonoDevelop.Core.IProgressMonitor monitor)
 {
     throw new NotImplementedException();
 }