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(CultureInfo.CurrentCulture)); } else { builder.Add("-begindate ", from.StartTime.ToString("s", CultureInfo.CurrentCulture)); builder.Add("-enddate ", to.StartTime.ToString("s", CultureInfo.CurrentCulture)); } } // we only ever need the most recent change builder.Add("-rowlimit ", "1"); AddCommonOptionalArguments(builder); return(ProcessInfoFor(builder, from)); }
// tf get itemspec [/version:versionspec] [/all] [/overwrite] [/force] // [/preview] [/recursive] [/noprompt] private ProcessInfo GetWorkSpaceProcessInfo(IIntegrationResult result) { var buffer = new PrivateArguments( "get", "/recursive", "/noprompt"); if (All) { buffer.Add("/all"); } if (Overwrite) { buffer.Add("/overwrite"); } if (Force) { buffer.Add("/force"); } buffer.AddQuote(WorkingDirectory); AppendSourceControlAuthentication(buffer); return(NewProcessInfo(buffer, result)); }
private ProcessInfo RemoveLabelProcessInfo(IIntegrationResult result) { var builder = new PrivateArguments(); builder.Add("deletelabel ", _shim.Folder); builder.Add(result.Label); AddCommonOptionalArguments(builder); return(ProcessInfoFor(builder, result)); }
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)); }
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)); }
// 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(System.Globalization.CultureInfo.CurrentCulture, "-r \"{{{0}}}:{{{1}}}\"", FormatCommandDate(from.StartTime), FormatCommandDate(to.StartTime))); buffer.Add("--verbose --xml"); AppendCommonSwitches(buffer, url != this.TrunkUrl); return(NewProcessInfo(buffer, to)); }
// 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(System.Globalization.CultureInfo.CurrentCulture, "-r {0}:HEAD", string.IsNullOrEmpty(lastRevision) ? "0" : lastRevision)); buffer.Add("--verbose --xml"); AppendCommonSwitches(buffer, url != this.TrunkUrl); return(NewProcessInfo(buffer, to)); }
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"); }
// "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); }
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); }
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(System.Globalization.CultureInfo.CurrentCulture, "-Vd{0}~{1}", locale.FormatCommandDate(to), locale.FormatCommandDate(from))); AppendUsernameAndPassword(builder); builder.Add("-I-Y"); builder.Add(null, "-O@" + tempOutputFileName, true); return(builder); }
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-Y -W -GF- -GTM"); builder.AddIf(CleanCopy, "-GWR"); return(builder); }
// 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:", this.Workspace, true); AppendSourceControlAuthentication(buffer); return(NewProcessInfo(buffer, result)); }
// 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); AppendSourceControlAuthentication(buffer); return(NewProcessInfo(buffer, result)); }
// 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); AppendSourceControlAuthentication(buffer); return(NewProcessInfo(buffer, result)); }
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)); }
// 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(System.Globalization.CultureInfo.CurrentCulture, "-version:D{0}~D{1}", FormatCommandDate(from.StartTime), FormatCommandDate(to.StartTime))); buffer.Add("-recursive"); buffer.Add("-format:detailed"); AppendSourceControlAuthentication(buffer); return(NewProcessInfo(buffer, to)); }
// 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.AddQuote(result.Label, string.Format(System.Globalization.CultureInfo.CurrentCulture, "@{0}", ProjectPath)); buffer.AddQuote(WorkingDirectory); buffer.Add("/recursive"); buffer.Add("/comment:", "CCNet Build Label", true); AppendSourceControlAuthentication(buffer); return(NewProcessInfo(buffer, result)); }
// 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. if (!TagWorkingCopy) { AppendRevision(buffer, latestRevision); } AppendCommonSwitches(buffer); return(NewProcessInfo(buffer, result)); }
private void AppendSourceControlAuthentication(PrivateArguments buffer) { if (!string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password.PrivateValue)) { buffer.Add("/login:" + this.BuildTfsAuthenticationString()); } }
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()); }
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 void AppendUsernameAndPassword(PrivateArguments builder) { if (!string.IsNullOrEmpty(Username)) { PrivateString userPlusPass = "******"-Y" + Username + "," + Password.PrivateValue + "\""; builder.Add(userPlusPass); } }
private ProcessInfo CleanupWorkingCopy(IIntegrationResult result) { var buffer = new PrivateArguments("cleanup"); buffer.Add(null, Path.GetFullPath(result.BaseFromWorkingDirectory(WorkingDirectory)), true); return(NewProcessInfo(buffer, result)); }
private ProcessInfo RevertWorkingCopy(IIntegrationResult result) { var buffer = new PrivateArguments("revert", "--recursive"); buffer.Add(null, Path.GetFullPath(result.BaseFromWorkingDirectory(WorkingDirectory)), true); return(NewProcessInfo(buffer, result)); }
// tf workspaces /delete [/owner:ownername] [/computer:computername] // [/server:servername] workspacename private ProcessInfo DeleteWorkSpaceProcessInfo(IIntegrationResult result) { var buffer = new PrivateArguments("workspace", "/delete"); buffer.Add("-server:", Server); buffer.AddQuote(Workspace); AppendSourceControlAuthentication(buffer); return(NewProcessInfo(buffer, result)); }
// 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); AppendSourceControlAuthentication(buffer); return(NewProcessInfo(buffer, result)); }
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); }
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)); }
/// <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); }