public void AddWithPrefixedValueAdds()
 {
     var args = new PrivateArguments();
     args.Add("pre=", "test Value");
     Assert.AreEqual(1, args.Count);
     Assert.AreEqual("pre=test Value", args.ToString());
 }
        private ProcessResult ExecuteCommand(IIntegrationResult result, 
            string command, params string[] args)
        {
            var buffer = new PrivateArguments(command);
            buffer.Add(this.Source);
            foreach (var arg in args)
            {
                buffer.Add(string.Empty,
                    arg,
                    true);
            }

            var executable = string.IsNullOrEmpty(this.Executable) ?
                "GetMyCode" : this.Executable;
            var processInfo = new ProcessInfo(
                result.BaseFromWorkingDirectory(executable),
                buffer,
                result.WorkingDirectory);
            var processResult = this.Execute(processInfo);
            return processResult;
        }
예제 #3
0
		private ProcessInfo GetSourceProcessInfo(IIntegrationResult result, bool getByLabel)
		{
            var builder = new PrivateArguments();
			if (getByLabel)
			{
				builder.Add("getlabel ", _shim.Folder, true);
				builder.Add(result.Label);
				if (_shim.UseVaultWorkingDirectory)
					builder.Add("-labelworkingfolder ", result.BaseFromWorkingDirectory(_shim.WorkingDirectory), true);
				else
					builder.Add("-destpath ", result.BaseFromWorkingDirectory(_shim.WorkingDirectory), true);
			}
			else
			{
				builder.Add("get ", _shim.Folder, true);
				if (_shim.UseVaultWorkingDirectory)
					builder.Add("-performdeletions removeworkingcopy");
				else
					builder.Add("-destpath ", result.BaseFromWorkingDirectory(_shim.WorkingDirectory), true);
			}

			builder.Add("-merge ", "overwrite");
			builder.Add("-makewritable");
			builder.Add("-setfiletime ", _shim.setFileTime);
			AddCommonOptionalArguments(builder);
			return ProcessInfoFor(builder, result);
		}
예제 #4
0
 private PrivateArguments HistoryProcessInfoArgs(DateTime from, DateTime to, string tempOutputFileName)
 {
     var builder = new PrivateArguments();
     builder.Add("history ", Project, true);
     builder.Add(RecursiveCommandLineOption);
     builder.Add(string.Format("-Vd{0}~{1}", locale.FormatCommandDate(to), locale.FormatCommandDate(from)));
     AppendUsernameAndPassword(builder);
     builder.Add("-I-Y");
     builder.Add(null, "-O@" + tempOutputFileName, true);
     return builder;
 }
예제 #5
0
 private void AppendUsernameAndPassword(PrivateArguments builder)
 {
     if (!string.IsNullOrEmpty(Username))
     {
         PrivateString userPlusPass = "******"-Y" + Username + "," + Password.PrivateValue + "\"";
         builder.Add(userPlusPass);
     }
 }
예제 #6
0
 private ProcessInfo PropGetProcessInfo(IIntegrationResult result)
 {
     var buffer = new PrivateArguments("propget");
     buffer.AddIf(CheckExternalsRecursive, "-R");
     AppendCommonSwitches(buffer);
     buffer.Add("svn:externals");
     buffer.Add(TrunkUrl);
     return NewProcessInfo(buffer, result);
 }
예제 #7
0
 //        HISTORY_COMMAND_FORMAT = "log url --revision {LastRevision}:HEAD --verbose --xml --non-interactive";
 private ProcessInfo NewHistoryProcessInfoFromRevision(string lastRevision, IIntegrationResult to, string url)
 {
     var buffer = new PrivateArguments("log");
     buffer.Add(null, url, true);
     buffer.Add(string.Format("-r {0}:HEAD", string.IsNullOrEmpty(lastRevision) ? "0" : lastRevision));
     buffer.Add("--verbose --xml");
     AppendCommonSwitches(buffer, url != this.TrunkUrl);
     return NewProcessInfo(buffer, to);
 }
예제 #8
0
 private ProcessInfo NewGetSourceProcessInfo(IIntegrationResult result)
 {
     var buffer = new PrivateArguments("update");
     buffer.Add(null, Path.GetFullPath(result.BaseFromWorkingDirectory(WorkingDirectory)), true);
     // Do not use Modification.GetLastChangeNumber() here directly.
     AppendRevision(buffer, latestRevision);
     AppendCommonSwitches(buffer);
     if (ForceUpdate) buffer.Add("--force");
     return NewProcessInfo(buffer, result);
 }
예제 #9
0
 // tf workfold [/map] [/s:servername] [/workspace: workspacename]
 //  repositoryfolder|localfolder
 private ProcessInfo MapWorkSpaceProcessInfo(IIntegrationResult result)
 {
     var buffer = new PrivateArguments(
         "workfold",
         "/map");
     buffer.AddQuote(ProjectPath);
     buffer.AddQuote(WorkingDirectory);
     buffer.Add("/server:", Server);
     buffer.Add("/workspace:", Workspace);
     return NewProcessInfo(buffer, result);
 }
예제 #10
0
 // tf workspaces /delete [/owner:ownername] [/computer:computername]
 // [/server:servername] workspacename
 private ProcessInfo DeleteWorkSpaceProcessInfo(IIntegrationResult result)
 {
     var buffer = new PrivateArguments(
         "workspace",
         "/delete");
     // buffer.Add("/computer:", Environment.MachineName);
     buffer.Add("-server:", Server);
     buffer.AddQuote(Workspace);
     return NewProcessInfo(buffer, result);
 }
예제 #11
0
 // tf workspace /new [/noprompt] [/template:workspacename[;workspaceowner]]
 // [/computer:computername] [/comment:(“comment”|@comment file)]
 // [/s:servername] [workspacename[;workspaceowner]]
 private ProcessInfo CreateWorkSpaceProcessInfo(IIntegrationResult result)
 {
     var buffer = new PrivateArguments(
         "workspace",
         "/new");
     buffer.Add("/computer:", Environment.MachineName);
     buffer.AddQuote("/comment:", DEFAULT_WORKSPACE_COMMENT);
     buffer.Add("/server:", Server);
     buffer.AddQuote(Workspace);
     return NewProcessInfo(buffer, result);
 }
예제 #12
0
 // tf workspaces [/computer:computername][/server:servername] workspacename
 private ProcessInfo CheckWorkSpaceProcessInfo(IIntegrationResult result)
 {
     var buffer = new PrivateArguments(
         "workspaces");
     buffer.Add("/computer:", Environment.MachineName);
     buffer.Add("-server:", Server);
     buffer.Add("/format:detailed");
     buffer.AddQuote(Workspace);
     return NewProcessInfo(buffer, result);
 }
예제 #13
0
        // tf dir [/server:servername] itemspec [/version:versionspec]
        // [/recursive] [/folders] [/deleted]
        private ProcessInfo CheckProjectProcessInfo(IIntegrationResult result)
        {
            var buffer = new PrivateArguments(
                "dir",
                "/folders");
            buffer.Add("/server:", Server);
            buffer.AddQuote(ProjectPath);

            return NewProcessInfo(buffer, result);
        }
예제 #14
0
        /// <summary>
        /// Adds the common optional arguments.	
        /// </summary>
        /// <param name="builder">The builder.</param>
        /// <remarks></remarks>
        protected void AddCommonOptionalArguments(PrivateArguments builder)
		{
			builder.AddIf(!string.IsNullOrEmpty(_shim.Host), "-host ", _shim.Host);
            builder.AddIf(!string.IsNullOrEmpty(_shim.Username), "-user ", _shim.Username);
            builder.AddIf(_shim.Password != null, "-password ", _shim.Password);
            builder.AddIf(!string.IsNullOrEmpty(_shim.Repository), "-repository ", _shim.Repository, true);
			builder.AddIf(_shim.Ssl, "-ssl");

			builder.AddIf(!string.IsNullOrEmpty(_shim.proxyServer), "-proxyserver ", _shim.proxyServer);
            builder.AddIf(!string.IsNullOrEmpty(_shim.proxyPort), "-proxyport ", _shim.proxyPort);
            builder.AddIf(!string.IsNullOrEmpty(_shim.proxyUser), "-proxyuser ", _shim.proxyUser);
            builder.AddIf(!string.IsNullOrEmpty(_shim.proxyPassword), "-proxypassword ", _shim.proxyPassword);
            builder.AddIf(!string.IsNullOrEmpty(_shim.proxyDomain), "-proxydomain ", _shim.proxyDomain);

			builder.Add(_shim.otherVaultArguments);
		}
예제 #15
0
		// "history ""{0}"" -excludeactions label,obliterate -rowlimit 0 -begindate {1:s} -enddate {2:s}
		// rowlimit 0 or -1 means unlimited (default is 1000 if not specified)
		// TODO: might want to make rowlimit configurable?
		private PrivateArguments BuildHistoryProcessArgs(DateTime from, DateTime to)
		{
            var builder = new PrivateArguments();
			builder.Add("history ", _shim.Folder);
			builder.Add(_shim.HistoryArgs);
			builder.Add("-begindate ", from.ToString("s", CultureInfo.CurrentCulture));
			builder.Add("-enddate ", to.ToString("s", CultureInfo.CurrentCulture));
			AddCommonOptionalArguments(builder);
            return builder;
		}
예제 #16
0
        private ProcessInfo CleanupWorkingCopy(IIntegrationResult result)
        {
            var buffer = new PrivateArguments("cleanup");
            buffer.Add(null, Path.GetFullPath(result.BaseFromWorkingDirectory(WorkingDirectory)), true);

            return NewProcessInfo(buffer, result);
        }
예제 #17
0
 private ProcessInfo NewCheckoutProcessInfo(IIntegrationResult result)
 {
     var buffer = new PrivateArguments("checkout");
     buffer.Add(string.Empty, TrunkUrl, true);
     buffer.Add(null, Path.GetFullPath(result.BaseFromWorkingDirectory(WorkingDirectory)), true);
     AppendCommonSwitches(buffer);
     return NewProcessInfo(buffer, result);
 }
예제 #18
0
        //    HISTORY_COMMAND_FORMAT = "tf history -noprompt -server:http://tfsserver:8080 $/TeamProjectName/path
        //  -version:D2006-12-01T01:01:01Z~D2006-12-13T20:00:00Z -recursive
        // -format:detailed -login:DOMAIN\name,password"
        private ProcessInfo NewHistoryProcessInfo(IIntegrationResult from, IIntegrationResult to)
        {
            var buffer = new PrivateArguments(
                "history",
                "-noprompt");
            buffer.Add("-server:", Server);
            buffer.AddQuote(ProjectPath);
            buffer.Add(String.Format("-version:D{0}~D{1}", FormatCommandDate(from.StartTime), FormatCommandDate(to.StartTime)));
            buffer.Add("-recursive");
            buffer.Add("-format:detailed");

            if (!string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password.PrivateValue))
            {
                if (!string.IsNullOrEmpty(Domain))
                {
                    Username = Domain + @"\" + Username;
                }

                buffer.Add("-login:" + this.Username, this.Password);
            }

            return NewProcessInfo(buffer, to);
        }
예제 #19
0
 //        HISTORY_COMMAND_FORMAT = "log url --revision \"{{{StartDate}}}:{{{EndDate}}}\" --verbose --xml --non-interactive";
 private ProcessInfo NewHistoryProcessInfo(IIntegrationResult from, IIntegrationResult to, string url)
 {
     var buffer = new PrivateArguments("log");
     buffer.Add(null, url, true);
     buffer.Add(string.Format("-r \"{{{0}}}:{{{1}}}\"", FormatCommandDate(from.StartTime), FormatCommandDate(to.StartTime)));
     buffer.Add("--verbose --xml");
     AppendCommonSwitches(buffer, url != this.TrunkUrl);
     return NewProcessInfo(buffer, to);
 }
예제 #20
0
 //    LABEL_COMMAND_FORMAT = "label [/server:servername] labelname[@scope] [/owner:ownername]
 //  itemspec [/version:versionspec] [/comment:("comment"|@commentfile)]
 //  [/child:(replace|merge)] [/recursive]"
 private ProcessInfo NewLabelProcessInfo(IIntegrationResult result)
 {
     var buffer = new PrivateArguments(
         "label");
     buffer.Add("/server:", Server);
     buffer.Add(result.Label);
     buffer.AddQuote(WorkingDirectory);
     buffer.Add("/recursive");
     return NewProcessInfo(buffer, result);
 }
예제 #21
0
 //        TAG_COMMAND_FORMAT = "copy --message "CCNET build label" "trunkUrl" "tagBaseUrl/label"
 private ProcessInfo NewLabelProcessInfo(IIntegrationResult result)
 {
     var buffer = new PrivateArguments("copy");
     buffer.Add(null, TagMessage(result.Label), true);
     buffer.Add(null, TagSource(result), true);
     buffer.Add(null, TagDestination(result.Label), true);
     // Do not use Modification.GetLastChangeNumber() here directly.
     AppendRevision(buffer, latestRevision);
     AppendCommonSwitches(buffer);
     return NewProcessInfo(buffer, result);
 }
예제 #22
0
        private ProcessInfo GetSourceProcessInfo(IIntegrationResult result)
        {
            var builder = new PrivateArguments();

            builder.Add("getversion ", _folderVersion.ToString());
            builder.Add(null, _shim.Folder, true);

            if (!string.IsNullOrEmpty(_shim.WorkingDirectory))
            {
                builder.Add(null, result.BaseFromWorkingDirectory(_shim.WorkingDirectory), true);
                if (_shim.UseVaultWorkingDirectory)
                {
                    builder.Add("-useworkingfolder");
                }
            }

            builder.Add("-merge ", "overwrite");
            builder.Add("-makewritable");
            builder.Add("-backup ", "no");
            builder.Add("-setfiletime ", _shim.setFileTime);
            AddCommonOptionalArguments(builder);
            return ProcessInfoFor(builder, result);
        }
예제 #23
0
        private ProcessInfo RevertWorkingCopy(IIntegrationResult result)
        {
            var buffer = new PrivateArguments("revert", "--recursive");
            buffer.Add(null, Path.GetFullPath(result.BaseFromWorkingDirectory(WorkingDirectory)), true);

            return NewProcessInfo(buffer, result);
        }
예제 #24
0
 private ProcessInfo LabelProcessInfo(IIntegrationResult result)
 {
     var builder = new PrivateArguments();
     builder.Add("label ", _shim.Folder);
     builder.Add(result.Label);
     builder.Add(_folderVersion);
     AddCommonOptionalArguments(builder);
     return ProcessInfoFor(builder, result);
 }
 public void AddWithAutoQuoteValueAdds()
 {
     var args = new PrivateArguments();
     args.Add("pre=", "test Value", true);
     Assert.AreEqual(1, args.Count);
     Assert.AreEqual("pre=\"test Value\"", args.ToString());
 }
예제 #26
0
        private ProcessInfo VersionHistoryProcessInfo(IIntegrationResult from, IIntegrationResult to, bool bForceGetLatestVersion)
        {
            var builder = new PrivateArguments();
            builder.Add("versionhistory ", _shim.Folder);

            // Look only for changes, unless caller asked us to get the latest folder
            // version regardless of whether there's been a change.
            if (!bForceGetLatestVersion)
            {
                // use folderVersion when possible because it's faster and more accurate
                if (_folderVersion != 0)
                {
                    builder.Add("-beginversion ", (_folderVersion + 1).ToString());
                }
                else
                {
                    builder.Add("-begindate ", from.StartTime.ToString("s"));
                    builder.Add("-enddate ", to.StartTime.ToString("s"));
                }
            }

            // we only ever need the most recent change
            builder.Add("-rowlimit ", "1");

            AddCommonOptionalArguments(builder);
            return ProcessInfoFor(builder, from);
        }
예제 #27
0
 private PrivateArguments GetSourceArgs(IIntegrationResult result)
 {
     var builder = new PrivateArguments();
     builder.Add("get ", Project + "/*?*", true);
     builder.Add(RecursiveCommandLineOption);
     builder.AddIf(ApplyLabel, "-VL", tempLabel);
     builder.AddIf(!AlwaysGetLatest, "-Vd", locale.FormatCommandDate(result.StartTime));
     AppendUsernameAndPassword(builder);
     builder.Add("-I-N -W -GF- -GTM");
     builder.AddIf(CleanCopy, "-GWR");
     return builder;
 }
예제 #28
0
        /// <summary>
        /// Creates the get process.	
        /// </summary>
        /// <param name="filename">The filename.</param>
        /// <returns></returns>
        /// <remarks></remarks>
		public ProcessInfo CreateGetProcess(string filename)
		{
			// @"getlatest ""{0}"" -s ""{1}"" -d ""{2}"" -u ""{3}"" -p ""{4}"" -localpath ""{5}"" -overwritewritable replace -overwritecheckedout replace -response:GetLatest.PathInvalid y -response:GetLatest.Writable y -response:GetLatest.CheckedOut y"
			var args = new PrivateArguments();
            args.Add("getlatest ", filename, true);
            args.Add("-s ", Server, true);
            args.Add("-d ", Database, true);
            args.Add("-u ", Username, true);
            args.Add("-p ", Password, true);
            args.AddIf(!string.IsNullOrEmpty(WorkingDirectory), "-localpath ", WorkingDirectory, true);
            args.Add("-overwritewritable replace -overwritecheckedout replace -response:GetLatest.PathInvalid y -response:GetLatest.Writable y -response:GetLatest.CheckedOut y");
            return new ProcessInfo(Executable, args);
		}
예제 #29
0
 private PrivateArguments LabelProcessInfoArgs(string label, string oldLabel)
 {
     var builder = new PrivateArguments();
     builder.Add("label ", Project, true);
     builder.Add("-L", label);
     builder.AddIf(!string.IsNullOrEmpty(oldLabel), "-VL", oldLabel);
     AppendUsernameAndPassword(builder);
     builder.Add("-I-Y");
     return builder;
 }
예제 #30
0
 private void AppendCommonSwitches(PrivateArguments buffer, bool isExternal)
 {
     if ((this.AuthCaching != AuthCachingMode.Always) && (!isExternal || (this.AuthCaching == AuthCachingMode.None)))
     {
         buffer.AddIf(!string.IsNullOrEmpty(this.Username), "--username ", this.Username, true);
         buffer.AddIf(this.Password != null, "--password ", this.Password, true);
         buffer.Add("--no-auth-cache");
     }
     buffer.Add("--non-interactive");
 }