// addSteps converts annotation substeps to buildbot steps and appends them
// dest.
// c is used only for logging.
437611
func (ac *annotationConverter) addSteps(c context.Context, dest *[]buildbot.Step, src []*miloProto.Step_Substep, stepNamePrefix string) error {
	for _, substep := range src {
		stepSrc := substep.GetStep()
		if stepSrc == nil {
			return errors.Reason("unexpected substep type %T", substep.Substep).Err()
		}

		stepDst, err := ac.step(c, stepSrc)
		if err != nil {
			return errors.Annotate(err, "could not convert step %q", stepNamePrefix+stepDst.Name).Err()
		}
		stepDst.Name = stepNamePrefix + stepDst.Name
		*dest = append(*dest, *stepDst)
		ac.addSteps(c, dest, stepSrc.Substep, stepDst.Name+".")
	}
	return nil
}
1184475
func AddCompilerMappings(mappings flux.CompilerMappings, dbrpMappingSvc platform.DBRPMappingService) error {
	return mappings.Add(CompilerType, func() flux.Compiler {
		return NewCompiler(dbrpMappingSvc)
	})
}
721361
func (b *FooJSONBuilder) AddAll() *FooJSONBuilder {
	b._properties["Tmp"] = b.Tmp
	b._properties["Bar"] = b.Bar
	b._properties["Buzz"] = b.Buzz
	b._properties["Hoge"] = b.Hoge
	b._properties["Fuga"] = b.Fuga
	return b
}
1364017
func (c *Client) AddMachines(args params.AddMachines) (params.AddMachinesResults, error) {
	if err := c.checkCanWrite(); err != nil {
		return params.AddMachinesResults{}, err
	}

	return c.AddMachinesV2(args)
}
1209349
func (b *SampleJSONBuilder) AddAll() *SampleJSONBuilder {
	b._properties["B"] = b.B
	b._properties["C"] = b.C
	b._properties["D"] = b.D
	b._properties["E"] = b.E
	return b
}
769369
func (b *TodoJSONBuilder) AddAll() *TodoJSONBuilder {
	b._properties["ID"] = b.ID
	b._properties["Text"] = b.Text
	b._properties["Done"] = b.Done
	b._properties["UpdatedAt"] = b.UpdatedAt
	b._properties["CreatedAt"] = b.CreatedAt
	return b
}
1010619
func RegisterActionStep(typeName string, performable Performable) {
	if performable != nil {
		steps[typeName] = performable
	} else {
		panic("cannot register nil step for type " + typeName)
	}
}
914685
func (we *WorkflowExecutor) AddAnnotation(key, value string) error {
	return common.AddPodAnnotation(we.ClientSet, we.PodName, we.Namespace, key, value)
}
993811
func miloBuildStep(c context.Context, ub URLBuilder, anno *miloProto.Step, includeChildren bool) ui.BuildComponent {

	comp := ui.BuildComponent{
		Label: ui.NewLink(anno.Name, "", anno.Name),
	}
	switch anno.Status {
	case miloProto.Status_RUNNING:
		comp.Status = model.Running

	case miloProto.Status_SUCCESS:
		comp.Status = model.Success

	case miloProto.Status_FAILURE:
		if fd := anno.GetFailureDetails(); fd != nil {
			switch fd.Type {
			case miloProto.FailureDetails_EXCEPTION, miloProto.FailureDetails_INFRA:
				comp.Status = model.InfraFailure

			case miloProto.FailureDetails_EXPIRED:
				comp.Status = model.Expired

			default:
				comp.Status = model.Failure
			}

			if fd.Text != "" {
				comp.Text = append(comp.Text, fd.Text)
			}
		} else {
			comp.Status = model.Failure
		}

	case miloProto.Status_PENDING:
		comp.Status = model.NotRun

		// Missing the case of waiting on unfinished dependency...
	default:
		comp.Status = model.NotRun
	}

	// Main link is a link to the stdout.
	var stdoutLink *miloProto.Link
	if anno.StdoutStream != nil {
		stdoutLink = &miloProto.Link{
			Label: "stdout",
			Value: &miloProto.Link_LogdogStream{
				LogdogStream: anno.StdoutStream,
			},
		}
	}

	if anno.Link != nil {
		comp.MainLink = ui.LinkSet{ub.BuildLink(anno.Link)}

		// If we also have a STDOUT stream, add it to our OtherLinks.
		if stdoutLink != nil {
			anno.OtherLinks = append([]*miloProto.Link{stdoutLink}, anno.OtherLinks...)
		}
	} else if stdoutLink != nil {
		comp.MainLink = ui.LinkSet{ub.BuildLink(stdoutLink)}
	}

	// Add STDERR link, if available.
	if anno.StderrStream != nil {
		anno.OtherLinks = append(anno.OtherLinks, &miloProto.Link{
			Label: "stderr",
			Value: &miloProto.Link_LogdogStream{
				LogdogStream: anno.StderrStream,
			},
		})
	}

	// Sub link is for one link per log that isn't stdout.
	for _, link := range anno.GetOtherLinks() {
		if l := ub.BuildLink(link); l != nil {
			comp.SubLink = append(comp.SubLink, ui.LinkSet{l})
		}
	}

	// This should always be a step.
	comp.Type = ui.StepLegacy

	// Timestamps
	var start, end time.Time
	if t, err := ptypes.Timestamp(anno.Started); err == nil {
		start = t
	}
	if t, err := ptypes.Timestamp(anno.Ended); err == nil {
		end = t
	}
	comp.ExecutionTime = ui.NewInterval(c, start, end)

	// This should be the exact same thing.
	comp.Text = append(comp.Text, anno.Text...)

	if !includeChildren {
		return comp
	}

	ss := anno.GetSubstep()
	comp.Children = make([]*ui.BuildComponent, 0, len(ss))

	// Process nested steps.
	for _, substep := range ss {
		var subanno *miloProto.Step
		switch s := substep.GetSubstep().(type) {
		case *miloProto.Step_Substep_Step:
			subanno = s.Step
		case *miloProto.Step_Substep_AnnotationStream:
			panic("Non-inline substeps not supported")
		default:
			panic(fmt.Errorf("Unknown type %v", s))
		}
		subcomp := miloBuildStep(c, ub, subanno, includeChildren)
		comp.Children = append(comp.Children, &subcomp)
	}

	return comp
}
1086127
func (p *PodSyncResult) AddSyncResult(result ...*SyncResult) {
	p.SyncResults = append(p.SyncResults, result...)
}
427034
func (mm *methodManager) AddMethods(
	names []string, obj interface{}, aliases []string, option ...Options) {
	if obj == nil {
		panic("obj can't be nil")
	}
	count := len(names)
	if aliases == nil {
		for i := 0; i < count; i++ {
			mm.AddMethod(names[i], obj, "", option...)
		}
		return
	}
	if len(aliases) != count {
		panic("names and aliases must have the same length")
	}
	for i := 0; i < count; i++ {
		mm.AddMethod(names[i], obj, aliases[i], option...)
	}
}
1244976
func (t *TagReplace) AddEvents(ctx context.Context, events []*event.Event) error {
	return t.next.AddEvents(ctx, events)
}
1348267
func (c *memoryClient) addToStreams(s *rawpresentation.Streams, anno *miloProto.Step) error {
	if lds := anno.StdoutStream; lds != nil {
		if err := c.addLogDogTextStream(s, lds); err != nil {
			return fmt.Errorf(
				"Encountered error while processing step streams for STDOUT: %s", err)
		}
	}
	if lds := anno.StderrStream; lds != nil {
		if err := c.addLogDogTextStream(s, lds); err != nil {
			return fmt.Errorf(
				"Encountered error while processing step streams for STDERR: %s", err)
		}
	}

	// Look for substream.
	for _, link := range anno.GetOtherLinks() {
		lds := link.GetLogdogStream()
		// Not a logdog stream.
		if lds == nil {
			continue
		}

		if err := c.addLogDogTextStream(s, lds); err != nil {
			return fmt.Errorf(
				"Encountered error while processing step streams for '%s'\n%s", lds.Name, err)
		}
	}

	// Now do substeps.
	for _, subStepEntry := range anno.Substep {
		substep := subStepEntry.GetStep()
		if substep == nil {
			continue
		}

		if err := c.addToStreams(s, substep); err != nil {
			return err
		}
	}

	return nil
}
8795
func (b *builder) addNodelets(node *Node, nodeID int) bool {
	var nodelets string

	// Populate two Tag slices, one for LabelTags and one for NumericTags.
	var ts []*Tag
	lnts := make(map[string][]*Tag)
	for _, t := range node.LabelTags {
		ts = append(ts, t)
	}
	for l, tm := range node.NumericTags {
		for _, t := range tm {
			lnts[l] = append(lnts[l], t)
		}
	}

	// For leaf nodes, print cumulative tags (includes weight from
	// children that have been deleted).
	// For internal nodes, print only flat tags.
	flatTags := len(node.Out) > 0

	// Select the top maxNodelets alphanumeric labels by weight.
	SortTags(ts, flatTags)
	if len(ts) > maxNodelets {
		ts = ts[:maxNodelets]
	}
	for i, t := range ts {
		w := t.CumValue()
		if flatTags {
			w = t.FlatValue()
		}
		if w == 0 {
			continue
		}
		weight := b.config.FormatValue(w)
		nodelets += fmt.Sprintf(`N%d_%d [label = "%s" id="N%d_%d" fontsize=8 shape=box3d tooltip="%s"]`+"\n", nodeID, i, t.Name, nodeID, i, weight)
		nodelets += fmt.Sprintf(`N%d -> N%d_%d [label=" %s" weight=100 tooltip="%s" labeltooltip="%s"]`+"\n", nodeID, nodeID, i, weight, weight, weight)
		if nts := lnts[t.Name]; nts != nil {
			nodelets += b.numericNodelets(nts, maxNodelets, flatTags, fmt.Sprintf(`N%d_%d`, nodeID, i))
		}
	}

	if nts := lnts[""]; nts != nil {
		nodelets += b.numericNodelets(nts, maxNodelets, flatTags, fmt.Sprintf(`N%d`, nodeID))
	}

	fmt.Fprint(b, nodelets)
	return nodelets != ""
}
626128
func (p *stepConverter) convertSubsteps(c context.Context, bbSteps *[]*pb.Step, annSubsteps []*annotpb.Step_Substep, stepPrefix string) ([]*pb.Step, error) {
	bbSubsteps := make([]*pb.Step, 0, len(annSubsteps))
	for _, annSubstep := range annSubsteps {
		annStep := annSubstep.GetStep()
		if annStep == nil {
			return nil, errors.Reason("unexpected non-Step substep %v", annSubstep).Err()
		}

		bbSubstep, err := p.convertSteps(c, bbSteps, annStep, stepPrefix)
		if err != nil {
			return nil, err
		}

		bbSubsteps = append(bbSubsteps, bbSubstep)
	}

	return bbSubsteps, nil
}
293942
func getHookInstallSteps() string {
	hookDir, err := cfg.HookDir()
	if err != nil {
		ExitWithError(err)
	}
	hooks := lfs.LoadHooks(hookDir, cfg)
	steps := make([]string, 0, len(hooks))
	for _, h := range hooks {
		steps = append(steps, fmt.Sprintf(
			"Add the following to .git/hooks/%s:\n\n%s",
			h.Type, tools.Indent(h.Contents)))
	}

	return strings.Join(steps, "\n\n")
}
223580
func (cmd *CLI) AddSubCommands(subcmds ...*SubCommand) {
	for _, subcmd := range subcmds {
		cmd.AddSubCommand(subcmd)
	}
}