예제 #1
0
        protected override void ProcessRecord()
        {
            var parsedCommandLine = commandLineParser.ParseCommandLine(String.Format(DescribeCommand, Changeset));
            var invoke            = this.processWrapper.Invoke(parsedCommandLine.Item1, parsedCommandLine.Item2);

            if (invoke.Item1 != 0)
            {
                this.ThrowTerminatingError(new ErrorRecord(new Exception(string.Join(Environment.NewLine, invoke.Item2)), $"Non zero return code: {invoke.Item1}", ErrorCategory.OperationStopped, this));
            }

            var changeset = describeParser.Parse(invoke.Item2);

            this.cmdlet.WriteObject(changeset);
        }
        public int Extract()
        {
            logger.LogToConsole("Invoking: " + p4ChangesCommandLine);
            var parsedCommand = this.commandLineParser.ParseCommandLine(p4ChangesCommandLine);

            var invoke = this.processWrapper.Invoke(parsedCommand.Item1, parsedCommand.Item2);

            if (invoke.Item1 != 0)
            {
                return(invoke.Item1);
            }

            var changes = changesParser.Parse(invoke.Item2);

            logger.LogToConsole($"Found {changes.Count} changesets to parse");

            this.bugDatabaseProcessor.ProcessCache(this.changesetProcessor);

            int i = 0;

            this.stopWatch.Restart();

            foreach (var change in changes)
            {
                ReportProgressAfterOneMinute(i, changes);

                var cmd = commandLineParser.ParseCommandLine(String.Format(p4DescribeCommandLine, change));

                var describeInvoke = this.processWrapper.Invoke(cmd.Item1, cmd.Item2);
                if (describeInvoke.Item1 != 0)
                {
                    this.stopWatch.Stop();
                    return(describeInvoke.Item1);
                }

                changesetProcessor.ProcessChangeset(describeParser.Parse(describeInvoke.Item2));

                i++;
            }
            this.stopWatch.Stop();

            this.outputProcessor.ProcessOutput(outputType, outputFile, this.changesetProcessor.Output);
            return(0);
        }