示例#1
0
        public void SvnClientExecuteWithArguments()
        {
            SvnClient client = new SvnClient();
            client.Command = "diff";
            client.Arguments = "--non-interactive --no-auth-cache";

            string expectedCommand = "diff --non-interactive --no-auth-cache";
            string actualCommand = TaskUtility.GetToolTaskCommand(client);
            Assert.AreEqual(expectedCommand, actualCommand);
        }
示例#2
0
        public void SvnClientExecute()
        {
            string targetFile = "myfile.txt";
            SvnClient client = new SvnClient();
            client.Command = "revert";
            client.Targets = new ITaskItem[] {new TaskItem(targetFile)};

            string expectedCommand = String.Format("revert \"{0}\"", targetFile);
            string actualCommand = TaskUtility.GetToolTaskCommand(client);
            Assert.AreEqual(expectedCommand, actualCommand);
        }
        private bool GetSourceInfomation(IList<SourceFile> sourceFiles, out string output)
        {
            output = string.Empty;

            // get all the svn info in one call
            SvnClient client = new SvnClient();
            CopyBuildEngine(client);

            // using target file to prevent hitting max command line lenght
            string targetFile = Path.GetTempFileName();

            try
            {
                // dumping source file list to target file
                using (var sw = File.CreateText(targetFile))
                    foreach (var sourceFile in sourceFiles)
                        // can only get info on files that exists
                        if (File.Exists(sourceFile)) 
                            sw.WriteLine(sourceFile);

                client.Command = "info";
                client.TargetFile = targetFile;
                client.Xml = true;

                client.Execute();
            }
            finally
            {
                File.Delete(targetFile);
            }

            output = client.StandardOutput;
            return true;
        }