public SourceDepotCommandResult Revert(string filePattern) { List <string> commandArguments = new List <string>(); commandArguments.Add(filePattern); var command = new SourceDepotCommand() { Name = "revert", Arguments = commandArguments }; var result = base.Execute(command); return(new SourceDepotCommandResult(result)); }
/// <summary> /// Gets desrciption of the specified label. /// </summary> /// <param name="labelName">Name of the label to find description for.</param> /// <returns>Result of sd label -o {0}, where {0} is <paramref name="labelName"/>.</returns> public SourceDepotCommandResult LabelDescription(string labelName) { var commandArguments = new List <string>(); commandArguments.Add("-o"); commandArguments.Add(labelName); // Sync to get the latest files from core depot var command = new SourceDepotCommand { Name = "label", Arguments = commandArguments }; var result = base.Execute(command, false); return(new SourceDepotCommandResultLabel(result)); }
/// <summary> /// Synchronizes the specified file pattern in depot. /// </summary> /// <param name="filePattern">Pattern to synchronize.</param> public SourceDepotCommandResult Sync(string filePattern) { var commandArguments = new List <string>(); commandArguments.Add(filePattern); // Sync to get the latest files from core depot var command = new SourceDepotCommand() { Name = "sync", Arguments = commandArguments }; var result = base.Execute(command); return(new SourceDepotCommandResult(result)); }
/// <summary> /// Executes the specified command. /// </summary> /// <param name="command">Source depot command to be executed</param> /// <returns>Results of the source depot call.</returns> private SDResults ExecuteCommand(SourceDepotCommand command) { if (command.Arguments != null) { foreach (string argument in command.Arguments) { this.connection.AddArg(argument); } } SDResults results = this.connection.Run(command.Name, true, false); results.WaitUntilFinished(); return(results); }
/// <summary> /// Executes the command and allows to specify whether structured output needs to be created. /// </summary> /// <param name="command">Source depot command to be executed</param> /// <param name="structuredOutput">Parameter passed into connection.Run() method.</param> /// <returns>Results of the source depot call.</returns> protected SDResults Execute(SourceDepotCommand command, bool structuredOutput) { var results = ExecuteCommand(command, structuredOutput); if (results.ErrorOutput.Count > 0) { var sb = new StringBuilder(); foreach (SDCommandOutput item in results.ErrorOutput) { sb.AppendLine(item.Message); } throw new SourceDepotException(sb.ToString()); } return(results); }
public SourceDepotCommandResult Submit() { if (string.IsNullOrEmpty(this.sdChangeListNumber)) { throw new SourceDepotException("You need to create first a change list before using this method"); } var commandArguments = new List <string>(); commandArguments.Add(string.Format("-c {0}", this.sdChangeListNumber)); var command = new SourceDepotCommand() { Name = "submit", Arguments = commandArguments }; var result = base.Execute(command); return(new SourceDepotCommandResult(result)); }
public int NumberOfFilesInChangeList(out Microsoft.OffGlobe.SourceDepot.SourceDepotCommandResult resultSD) { int numberOfFiles = 0; if (string.IsNullOrEmpty(this.sdChangeListNumber)) { throw new SourceDepotException("You need to create first a change list before using this method"); } var commandArguments = new List <string>(); commandArguments.Add(this.sdChangeListNumber); var command = new SourceDepotCommand() { Name = "describe", Arguments = commandArguments }; var result = base.Execute(command); resultSD = new SourceDepotCommandResultDescribe(result); for (int counter = 0; counter < result.StructuredOutput[0].Variables.Count; counter++) { if (result.StructuredOutput[0].Variables.SpecData == null) { /* * Console.WriteLine("Variable name is: {0}", result.StructuredOutput[0].Variables[counter].Name); * Console.WriteLine("Variable value is: {0}", result.StructuredOutput[0].Variables[counter].Value); */ if (result.StructuredOutput[0].Variables[counter].Name.Contains("depotFile")) { numberOfFiles++; } } } return(numberOfFiles); }