예제 #1
0
        public static ProcessResult RunSvnProcess(SvnOptions svnLoginOptions, ProcessArgumentBuilder argBuilder)
        {
            argBuilder.AddArgument("--non-interactive");
            argBuilder.AddArgument("--no-auth-cache");

            ProcessInfo info = new ProcessInfo("svn.exe", argBuilder.ToString());

            ProcessExecutor executor = new ProcessExecutor();
            ProcessResult result = executor.Execute(info);
            return result;
        }
예제 #2
0
        public override string ToString()
        {
            ProcessArgumentBuilder argsBuilder = new ProcessArgumentBuilder();
            argsBuilder.AddArgument("/xml", "=", outputfile);
            argsBuilder.AddArgument("/nologo");

            foreach (string assemblyName in assemblies)
            {
                argsBuilder.AddArgument(assemblyName);
            }
            return argsBuilder.ToString();
        }
예제 #3
0
 /// <summary>
 /// Appends the categories, with value not an empty string nor a whitespace,
 /// to the excluded or included categories lists.
 /// </summary>
 /// <param name="argsBuilder">The args builder.</param>
 private void AppendCategoriesArg(ProcessArgumentBuilder argsBuilder)
 {
     if (ExcludedCategories != null && ExcludedCategories.Length != 0)
     {
         string[] excludedCategories = System.Array.FindAll(ExcludedCategories, IsNotWhitespace);
         argsBuilder.AddArgument("/exclude", "=", string.Join(",", excludedCategories));
     }
     if (IncludedCategories != null && IncludedCategories.Length != 0)
     {
         string[] includedCategories = System.Array.FindAll(IncludedCategories, IsNotWhitespace);
         argsBuilder.AddArgument("/include", "=", string.Join(",", includedCategories));
     }
 }
예제 #4
0
        private string Args(IIntegrationResult result)
        {
            ProcessArgumentBuilder builder = new ProcessArgumentBuilder();

            builder.AddArgument("/nologo");
            if (! StringUtil.IsBlank(Targets)) builder.AddArgument("/t:" + Targets);
            builder.AddArgument(GetPropertyArgs(result));
            builder.AppendArgument(BuildArgs);
            builder.AddArgument(ProjectFile);
            builder.AddArgument(GetLoggerArgs(result));

            return builder.ToString();
        }
예제 #5
0
        public static int GetSvnRevision(SvnOptions svnOptions)
        {
            ProcessArgumentBuilder argBuilder = new ProcessArgumentBuilder();
            argBuilder.AppendArgument("log");
            argBuilder.AppendArgument("--xml");
            argBuilder.AppendArgument("--limit 1");
            argBuilder.AddArgument(StringHelper.Quote(svnOptions.Url));
            ProcessResult result = RunSvnProcess(svnOptions, argBuilder);

            XmlDocument xml = new XmlDocument();
            xml.LoadXml(result.StandardOutput);

            XmlNode node = xml.SelectSingleNode("/log/logentry/@revision");
            return Convert.ToInt32(node.InnerText);
        }
예제 #6
0
 //MEMBER_INFO_TEMPLATE = "memberinfo -S {SandboxRoot\SandboxFile} --user={user} --password={password} {member}"
 private string BuildMemberInfoCommandXml(Modification modification)
 {
     ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
     buffer.AppendArgument("memberinfo --xmlapi");
     AppendCommonArguments(buffer, false, true);
     string modificationPath = (modification.FolderName == null) ? SandboxRoot : Path.Combine(SandboxRoot, modification.FolderName);
     buffer.AddArgument(Path.Combine(modificationPath, modification.FileName));
     return buffer.ToString();
 }
예제 #7
0
        /// <summary>
        /// Updates and fetches git submodules.
        /// </summary>
        /// <param name="result"></param>
        private void GitUpdateSubmodules(IIntegrationResult result)
        {
            ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
            buffer.AddArgument("submodule");
            buffer.AddArgument("update");

            // initialize progress information
            var bpi = GetBuildProgressInformation(result);
            bpi.SignalStartRunTask(string.Concat("git ", buffer.ToString()));

            // enable Stdout monitoring
            ProcessExecutor.ProcessOutput += ProcessExecutor_ProcessOutput;

            Execute(NewProcessInfo(buffer.ToString(), result));

            // remove Stdout monitoring
            ProcessExecutor.ProcessOutput -= ProcessExecutor_ProcessOutput;
        }
예제 #8
0
		/// <summary>
		/// Push a specific tag with "git push origin tag 'tag name'".
		/// </summary>
		/// <param name="tagName">Naem of the tag to push.</param>
		/// <param name="result">IIntegrationResult of the current build.</param>
		private void GitPushTag(string tagName, IIntegrationResult result)
		{
			ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
			buffer.AddArgument("push");
			buffer.AddArgument("origin");
			buffer.AddArgument("tag");
			buffer.AddArgument(tagName);

			// initialize progress information
			var bpi = GetBuildProgressInformation(result);
			bpi.SignalStartRunTask(string.Concat("git ", buffer.ToString()));

			// enable Stdout monitoring
			ProcessExecutor.ProcessOutput += ProcessExecutor_ProcessOutput;

			Execute(NewProcessInfo(buffer.ToString(), result));

			// remove Stdout monitoring
			ProcessExecutor.ProcessOutput -= ProcessExecutor_ProcessOutput;
		}
예제 #9
0
		/// <summary>
		/// Add all modified and all untracked files that are not ignored by .gitignore
		/// to the git index with the "git add --all" command.
		/// </summary>
		/// <param name="result">IIntegrationResult of the current build.</param>
		private void GitAddAll(IIntegrationResult result)
		{
			ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
			buffer.AddArgument("add");
			buffer.AddArgument("--all");
			Execute(NewProcessInfo(buffer.ToString(), result));
		}
예제 #10
0
		/// <summary>
		/// Clean the working tree with "git clean -d -f -x".
		/// </summary>
		/// <param name="result">IIntegrationResult of the current build.</param>
		private void GitClean(IIntegrationResult result)
		{
			ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
			buffer.AddArgument("clean");
			buffer.AddArgument("-d");
			buffer.AddArgument("-f");
			buffer.AddArgument("-x");
			Execute(NewProcessInfo(buffer.ToString(), result));
		}
예제 #11
0
		/// <summary>
		/// Call "git config --get 'name'" to get the value of a local repository property.
        /// The command returns error code 1 if the key was not found and error code 2 if multiple key values were found. 
		/// </summary>
		/// <param name="name">Name of the config parameter.</param>
		/// <param name="result">IIntegrationResult of the current build.</param>
		/// <returns>Result of the "git config --get 'name'" command.</returns>
        private string GitConfigGet(string name, IIntegrationResult result)
		{
		    ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
		    buffer.AddArgument("config");
		    buffer.AddArgument("--get");
		    buffer.AddArgument(name);
		    return
		        Execute(NewProcessInfo(buffer.ToString(), result, ProcessPriorityClass.Normal, new int[] {0, 1, 2})).
		            StandardOutput.Trim();
		}
예제 #12
0
        private ProcessInfo NewCheckoutProcessInfo(IIntegrationResult result)
        {
            // CCNET-1796: work around a CVS limitation: the -d parameter only accepts limited relative paths
            // so the working directory is one level up of the checkout dir and
            // override checkout directory
            var wd = result.BaseFromWorkingDirectory(WorkingDirectory);
            var lastDirectorySeparatorIndex = wd.TrimEnd().TrimEnd(Path.DirectorySeparatorChar).LastIndexOf(Path.DirectorySeparatorChar);
            var checkoutWd = wd.Substring(0, lastDirectorySeparatorIndex);
            var checkoutDir = wd.Substring(lastDirectorySeparatorIndex).Trim(Path.DirectorySeparatorChar);
            Log.Debug("[CVS] Configured Working Directory: '{0}'", wd);
            Log.Debug("[CVS] Checkout Working Directory: '{0}'", checkoutWd);
            Log.Debug("[CVS] Checkout Directory: '{0}'", checkoutDir);

            ProcessArgumentBuilder builder = new ProcessArgumentBuilder();
            AppendCvsRoot(builder);
            builder.AddArgument("-q");
            builder.AddArgument("checkout");
            builder.AddArgument("-R");
            builder.AddArgument("-P");
            builder.AddArgument("-r", Branch);
            builder.AddArgument("-d", StringUtil.AutoDoubleQuoteString(checkoutDir));
            builder.AddArgument(Module);
            var pi = NewProcessInfoWithArgs(result, builder.ToString());
            pi.WorkingDirectory = checkoutWd;
            return pi;
        }
예제 #13
0
 // cvs [-d :ext:mycvsserver:/cvsroot/myrepo] -q log -N "-d>2004-12-24 12:00:00 GMT" -rmy_branch (with branch)
 // cvs [-d :ext:mycvsserver:/cvsroot/myrepo] -q log -Nb "-d>2004-12-24 12:00:00 GMT" (without branch)
 //        public const string HISTORY_COMMAND_FORMAT = @"{0}-q log -N{3} ""-d>{1}""{2}";		// -N means 'do not show tags'
 private string BuildLogProcessInfoArgs(DateTime from)
 {
     ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
     AppendCvsRoot(buffer);
     buffer.AddArgument("-q"); // quiet
     buffer.AddArgument("rlog");
     buffer.AddArgument("-N"); // do not show tags
     buffer.AppendIf(SuppressRevisionHeader, "-S");
     if (string.IsNullOrEmpty(Branch))
     {
         buffer.AddArgument("-b"); // only list revisions on HEAD
     }
     else
     {
         buffer.AppendArgument("-r{0}", Branch); // list revisions on branch
     }
     buffer.AppendArgument(@"""-d>{0}""", FormatCommandDate(from));
     if (!string.IsNullOrEmpty(RestrictLogins))
     {
         foreach (string login in RestrictLogins.Split(','))
         {
             buffer.AppendArgument("-w{0}", login.Trim());
         }
     }
     buffer.AddArgument(Module);
     return buffer.ToString();
 }
예제 #14
0
 private void AppendCvsRoot(ProcessArgumentBuilder buffer)
 {
     buffer.AddArgument("-d", CvsRoot);
 }
예제 #15
0
 /// <summary>
 /// Get the date and iime of the latest commit in the remote repository
 /// </summary>
 /// <param name="branchName">Name of the branch.</param>
 /// <param name="result">IIntegrationResult of the current build.</param>
 private string GitLogOriginHashDateTime(string branchName, IIntegrationResult result)
 {
     ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
     buffer.AddArgument("log");
     buffer.AddArgument(string.Concat("origin/", branchName));
     buffer.AddArgument("--date-order");
     buffer.AddArgument("-1");
     buffer.AddArgument("--pretty=format:\"%ci\"");
     return Execute(NewProcessInfo(buffer.ToString(), result)).StandardOutput;
 }
예제 #16
0
		/// <summary>
		/// Clone a repository into a new directory with "git clone 'repository' 'working directory'".
		/// </summary>
		/// <param name="result">IIntegrationResult of the current build.</param>
		private void GitClone(IIntegrationResult result)
		{
			string wd = BaseWorkingDirectory(result);

			ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
			buffer.AddArgument("clone");
			buffer.AddArgument(Repository);
			buffer.AddArgument(wd);

			// initialize progress information
			var bpi = GetBuildProgressInformation(result);
			bpi.SignalStartRunTask(string.Concat("git ", buffer.ToString()));

			// enable Stdout monitoring
			ProcessExecutor.ProcessOutput += ProcessExecutor_ProcessOutput;

			ProcessInfo pi = NewProcessInfo(buffer.ToString(), result);
			// Use upper level of the working directory, because the
			// working directory currently does not exist and
			// will be created by "git clone". "git clone" will fail if
			// the working directory already exist.
			pi.WorkingDirectory = Path.GetDirectoryName(wd.Trim().TrimEnd(Path.DirectorySeparatorChar));
			Execute(pi);

			// remove Stdout monitoring
			ProcessExecutor.ProcessOutput -= ProcessExecutor_ProcessOutput;
		}
예제 #17
0
		/// <summary>
		/// Call "git config 'name' 'value'" to set local repository properties.
		/// </summary>
		/// <param name="name">Name of the config parameter.</param>
		/// <param name="value">Value of the config parameter.</param>
		/// <param name="result">IIntegrationResult of the current build.</param>
		private void GitConfigSet(string name, string value, IIntegrationResult result)
		{
			ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
			buffer.AddArgument("config");
			buffer.AddArgument(name);
			buffer.AddArgument(value);
			Execute(NewProcessInfo(buffer.ToString(), result));
		}
예제 #18
0
        private ProcessInfo NewGetSourceProcessInfo(IIntegrationResult result)
        {
            ProcessArgumentBuilder builder = new ProcessArgumentBuilder();
            AppendCvsRoot(builder);
            builder.AppendArgument("-q update -d -P"); // build directories, prune empty directories
            builder.AppendIf(CleanCopy, "-C");
            builder.AddArgument("-r", Branch);

            return NewProcessInfoWithArgs(result, builder.ToString());
        }
예제 #19
0
		/// <summary>
        /// Checkout a remote branch or revision with the "git checkout -q -f 'origin/branchName'" or "git checkout -q -f 'revision'" command.
		/// </summary>
		/// <param name="branchOrRevision">Name of the branch to checkout.</param>
		/// <param name="result">IIntegrationResult of the current build.</param>
		private void GitCheckoutRemoteBranch(string branchOrRevision, IIntegrationResult result)
		{
			ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
			buffer.AddArgument("checkout");
			buffer.AddArgument("-q");
			buffer.AddArgument("-f");
			buffer.AddArgument(branchOrRevision);

			// initialize progress information
			var bpi = GetBuildProgressInformation(result);
			bpi.SignalStartRunTask(string.Concat("git ", buffer.ToString()));

			// enable Stdout monitoring
			ProcessExecutor.ProcessOutput += ProcessExecutor_ProcessOutput;

			Execute(NewProcessInfo(buffer.ToString(), result));

			// remove Stdout monitoring
			ProcessExecutor.ProcessOutput -= ProcessExecutor_ProcessOutput;
		}
예제 #20
0
		/// <summary>
		/// Get the commit history including changes between <paramref name="from"/> and origin/<paramref name="branchName"/>
		/// </summary>
		/// <param name="branchName">Name of the branch.</param>
		/// <param name="from">The commit from which to start logging.</param>
		/// <param name="to">IIntegrationResult of the current build.</param>
		/// <returns>Result of the "git log" command.</returns>
		private ProcessResult GitLogHistory(string branchName, string from, IIntegrationResult to)
		{
			ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
			buffer.AddArgument("log");
			buffer.AddArgument(string.Concat(from, "..origin/", branchName));
			AppendLogOptions(buffer);
			return Execute(NewProcessInfo(buffer.ToString(), to));
		}
예제 #21
0
		/// <summary>
		/// Automatically stage files that have been modified and deleted
		/// and commit them with the "git commit --all --allow-empty -m 'message'"
		/// command.
		/// </summary>
		/// <param name="commitMessage">Commit message.</param>
		/// <param name="result">IIntegrationResult of the current build.</param>
		private void GitCommitAll(string commitMessage, IIntegrationResult result)
		{
			ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
			buffer.AddArgument("commit");
			buffer.AddArgument("--all");
			buffer.AddArgument("--allow-empty");
			buffer.AddArgument("-m", commitMessage);
			Execute(NewProcessInfo(buffer.ToString(), result));
		}
예제 #22
0
        /// <summary>
        /// Retrieve the arguments
        /// </summary>
        /// <param name="result">The result.</param>
        /// <returns>A <c>string</c> containing the arguments.</returns>
        protected override string GetProcessArguments(IIntegrationResult result)
        {
            ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
            buffer.AddArgument("/quiet");
            buffer.AddArgument("/severityThreshold:\"" + this.ReportingThreshold.ToString() + "\"");
            buffer.AddArgument("/out:\"" + result.BaseFromWorkingDirectory("codeitright.xml") + "\"");
            if (!string.IsNullOrEmpty(this.Solution))
            {
                buffer.AddArgument("/Solution:\"" + this.EnsurePathIsRooted(result, this.Solution) + "\"");
            }
            else if (!string.IsNullOrEmpty(this.Project))
            {
                buffer.AddArgument("/Project:\"" + this.EnsurePathIsRooted(result, this.Project) + "\"");
            }
            else
            {
                throw new CruiseControlException("Either a solution or a project must be specified for analysis.");
            }

            if (!string.IsNullOrEmpty(this.Xsl))
            {
                buffer.AddArgument("/outxsl:\"" + this.EnsurePathIsRooted(result, this.Xsl) + "\"");
            }

            if (!string.IsNullOrEmpty(this.CRData))
            {
                buffer.AddArgument("/crdata:\"" + this.EnsurePathIsRooted(result, this.CRData) + "\"");
            }

            if (!string.IsNullOrEmpty(this.Profile))
            {
                buffer.AddArgument("/profile:\"" + this.Profile + "\"");
            }

            return buffer.ToString();
        }
예제 #23
0
		/// <summary>
		/// Create a unsigned tag with "git tag -a -m 'message' 'tag name'".
		/// </summary>
		/// <param name="tagName">Name of the tag.</param>
		/// <param name="tagMessage">Tag commit message.</param>
		/// <param name="result">IIntegrationResult of the current build.</param>
		private void GitCreateTag(string tagName, string tagMessage, IIntegrationResult result)
		{
			ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
			buffer.AddArgument("tag");
			buffer.AddArgument("-a");
			buffer.AddArgument("-m", tagMessage);
			buffer.AddArgument(tagName);
			Execute(NewProcessInfo(buffer.ToString(), result));
		}
예제 #24
0
        protected override string GetProcessArguments(IIntegrationResult result)
        {
            ProcessArgumentBuilder args = new ProcessArgumentBuilder();
            args.AddArgument("--rakefile", Rakefile);

            if (Silent)
                args.AddArgument("--silent");
            else if (Quiet)
                args.AddArgument("--quiet");

            if (Trace)
                args.AddArgument("--trace");

            args.AppendArgument(BuildArgs);

            foreach (string t in Targets)
                args.AppendArgument(t);

            return args.ToString();
        }
예제 #25
0
 /// <summary>
 /// Initialize the git submodules.
 /// </summary>
 /// <param name="result">IIntegrationResult of the current build.</param>
 private void GitInitSubmodules(IIntegrationResult result)
 {
     ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
     buffer.AddArgument("submodule");
     buffer.AddArgument("init");
     Execute(NewProcessInfo(buffer.ToString(), result));
 }
예제 #26
0
		/// <summary>
		/// Get the hash of the latest commit in the remote repository.
		/// </summary>
		/// <param name="branchNameOrRevision">Name of the branch or revision</param>
		/// <param name="result">IIntegrationResult of the current build.</param>
		private string GitLogOriginHash(string branchNameOrRevision, IIntegrationResult result)
		{
			ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
			buffer.AddArgument("log");
			buffer.AddArgument(branchNameOrRevision);
			buffer.AddArgument("-1");
			buffer.AddArgument("--pretty=format:\"%H\"");
			return Execute(NewProcessInfo(buffer.ToString(), result)).StandardOutput.Trim();
		}
예제 #27
0
        private void AppendCommonArguments(ProcessArgumentBuilder buffer, bool recurse, bool omitSandbox)
        {
            if (recurse)
            {
                buffer.AppendArgument("-R");
            }

            if (!omitSandbox)
            {
                buffer.AddArgument("-S", Path.Combine(SandboxRoot, SandboxFile));
            }

            buffer.AppendArgument("--user={0}", User);
            buffer.AppendArgument("--password={0}", Password);
            buffer.AppendArgument("--quiet");
        }
예제 #28
0
		private ProcessResult GitLogHistory(string branchNameOrRevision, IIntegrationResult to)
		{
			ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
			buffer.AddArgument("log");
			buffer.AddArgument(branchNameOrRevision);
			AppendLogOptions(buffer);
			return Execute(NewProcessInfo(buffer.ToString(), to));
		}
예제 #29
0
 private void RemoveReadOnlyAttribute()
 {
     ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
     buffer.AddArgument("-R");
     buffer.AddArgument("/s", SandboxRoot + "\\*");
     Execute(new ProcessInfo("attrib", buffer.ToString()));
 }
예제 #30
0
		private void AppendLogOptions(ProcessArgumentBuilder buffer)
		{
			buffer.AddArgument("--name-status");
			buffer.AddArgument(string.Concat("--pretty=format:", '"', historyFormat, '"'));
            buffer.AddArgument("-m"); // for getting the commits seen via merges
		}