// StepmanRawStepLibStepInfo ...
321492
func StepmanRawStepLibStepInfo(collection, stepID, stepVersion string) (string, error) {
	logLevel := log.GetLevel().String()
	args := []string{"--loglevel", logLevel, "step-info", "--collection", collection,
		"--id", stepID, "--version", stepVersion, "--format", "raw"}
	return command.RunCommandAndReturnCombinedStdoutAndStderr("stepman", args...)
}
605012
func stateStepsFor20() []Step {
	return []Step{
		&upgradeStep{
			description: "strip @local from local user names",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return context.State().StripLocalUserDomain()
			},
		},
		&upgradeStep{
			description: "rename addmodel permission to add-model",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return context.State().RenameAddModelPermission()
			},
		},
	}
}
125831
func (shardSwap *shardSchemaSwap) markStepInProgress(uiNode *workflow.Node) {
	uiNode.Message = ""
	uiNode.State = workflowpb.WorkflowState_Running
	uiNode.Display = workflow.NodeDisplayIndeterminate
	uiNode.BroadcastChanges(false /* updateChildren */)
}
892726
func NewSmartSyncNotOptOutDetails(PreviousValue *SmartSyncOptOutPolicy, NewValue *SmartSyncOptOutPolicy) *SmartSyncNotOptOutDetails {
	s := new(SmartSyncNotOptOutDetails)
	s.PreviousValue = PreviousValue
	s.NewValue = NewValue
	return s
}
1004849
func (s *Range) SetStep(v int64) *Range {
	s.Step = &v
	return s
}
1271272
func (t *Thread) StepInstruction() error {
	if err := t.stepInstruction(&threadUpdater{p: t.p}); err != nil {
		return err
	}
	return t.reloadRegisters()
}
522045
func (lifecycle *Lifecycle) NextStep(step int) {
	lifecycle.muStep.Lock()
	lifecycle.step = step
	lifecycle.muStep.Unlock()
}
1168768
func (fbo *folderBranchOps) doPartialMarkAndSweep(
	ctx context.Context, syncConfig keybase1.FolderSyncConfig,
	latestMerged ImmutableRootMetadata) (err error) {
	startTime, timer := fbo.startOp(
		ctx, "Starting partial mark-and-sweep at revision %d",
		latestMerged.Revision())
	defer func() {
		fbo.endOp(
			ctx, startTime, timer,
			"Partial mark-and-sweep at revision %d done: %+v",
			latestMerged.Revision(), err)
	}()

	if syncConfig.Mode != keybase1.FolderSyncMode_PARTIAL {
		return errors.Errorf(
			"Bad mode passed to partial unsync: %+v", syncConfig.Mode)
	} else if len(syncConfig.Paths) == 0 {
		return nil
	}

	rootNode, _, _, err := fbo.getRootNode(ctx)
	if err != nil {
		return err
	}
	tag := ctx.Value(CtxFBOIDKey).(string)
	lState := makeFBOLockState()
	cacheType := DiskBlockSyncCache
	err = fbo.blocks.MarkNode(
		ctx, lState, rootNode, latestMerged, tag, cacheType)
	if err != nil {
		return err
	}

pathLoop:
	for _, p := range syncConfig.Paths {
		select {
		case <-ctx.Done():
			return ctx.Err()
		default:
		}
		fbo.vlog.CLogf(ctx, libkb.VLog1, "Marking %s", p)

		// Mark the parent directories.
		parentPath, syncedElem := stdpath.Split(p)
		parents := strings.Split(strings.TrimSuffix(parentPath, "/"), "/")
		currNode := rootNode
		for _, parent := range parents {
			if len(parent) == 0 {
				continue
			}
			// TODO: parallelize the parent fetches and lookups.
			currNode, _, err = fbo.Lookup(ctx, currNode, parent)
			switch errors.Cause(err).(type) {
			case idutil.NoSuchNameError:
				fbo.vlog.CLogf(
					ctx, libkb.VLog1, "Synced path %s doesn't exist yet", p)
				continue pathLoop
			case nil:
			default:
				return err
			}

			err = fbo.blocks.MarkNode(
				ctx, lState, currNode, latestMerged, tag, cacheType)
			if err != nil {
				return err
			}
		}

		// Now mark everything rooted at this path.
		currNode, _, err = fbo.Lookup(ctx, currNode, syncedElem)
		switch errors.Cause(err).(type) {
		case idutil.NoSuchNameError:
			fbo.vlog.CLogf(
				ctx, libkb.VLog1, "Synced element %s doesn't exist yet", p)
			continue pathLoop
		case nil:
		default:
			return err
		}

		err = fbo.markRecursive(
			ctx, lState, currNode, latestMerged, tag, cacheType)
		if err != nil {
			return err
		}
	}

	return fbo.config.DiskBlockCache().DeleteUnmarked(
		ctx, fbo.id(), tag, cacheType)
}
1341195
func WriteStepSpecToFile(templateCollection models.StepCollectionModel, route SteplibRoute) error {
	pth := GetStepSpecPath(route)

	if exist, err := pathutil.IsPathExists(pth); err != nil {
		return err
	} else if !exist {
		dir, _ := path.Split(pth)
		err := os.MkdirAll(dir, 0777)
		if err != nil {
			return err
		}
	} else {
		err := os.Remove(pth)
		if err != nil {
			return err
		}
	}

	collection, err := generateStepLib(route, templateCollection)
	if err != nil {
		return err
	}

	bytes, err := json.MarshalIndent(collection, "", "\t")
	if err != nil {
		return err
	}

	if err := fileutil.WriteBytesToFile(pth, bytes); err != nil {
		return err
	}

	pth = GetSlimStepSpecPath(route)
	slimCollection := generateSlimStepLib(collection)
	if err != nil {
		return err
	}

	bytes, err = json.MarshalIndent(slimCollection, "", "\t")
	if err != nil {
		return err
	}

	return fileutil.WriteBytesToFile(pth, bytes)
}
292484
func (collection StepCollectionModel) GetStepVersion(id, version string) (StepVersionModel, bool, bool) {
	stepHash := collection.Steps
	stepVersions, stepFound := stepHash[id]

	if !stepFound {
		return StepVersionModel{}, stepFound, false
	}

	if version == "" {
		version = stepVersions.LatestVersionNumber
	}

	step, versionFound := stepVersions.Versions[version]

	if !stepFound || !versionFound {
		return StepVersionModel{}, stepFound, versionFound
	}

	return StepVersionModel{
		Step:                   step,
		Version:                version,
		LatestAvailableVersion: stepVersions.LatestVersionNumber,
	}, true, true
}
24732
func stateStepsFor221() []Step {
	return []Step{
		&upgradeStep{
			description: "add update-status hook config settings",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return context.State().AddUpdateStatusHookSettings()
			},
		},
		&upgradeStep{
			description: "correct relation unit counts for subordinates",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return context.State().CorrectRelationUnitCounts()
			},
		},
	}
}
176461
func stepsFor20() []Step {
	return []Step{
		&upgradeStep{
			description: "remove apiserver charm get cache",
			targets:     []Target{Controller},
			run:         removeCharmGetCache,
		},
	}
}
1321504
func (h *Client) CheckoutStep(checkoutStep int64) *Client {
	h.checkoutStep = checkoutStep
	h.checkoutStepSet = true
	return h
}
156531
func ParseStepGroupInfoModel(pth string) (models.StepGroupInfoModel, bool, error) {
	if exist, err := pathutil.IsPathExists(pth); err != nil {
		return models.StepGroupInfoModel{}, false, err
	} else if !exist {
		return models.StepGroupInfoModel{}, false, nil
	}

	bytes, err := fileutil.ReadBytesFromFile(pth)
	if err != nil {
		return models.StepGroupInfoModel{}, true, err
	}

	var globalStepInfo models.StepGroupInfoModel
	if err := yaml.Unmarshal(bytes, &globalStepInfo); err != nil {
		return models.StepGroupInfoModel{}, true, err
	}

	return globalStepInfo, true, nil
}
1086828
func GetStep(s Step) string {
	return fmt.Sprintf("{\"sequence\"=>\"%d\",\"state\"=>\"%s\",\"errors\"=>%s,\"warnings\"=>%s,\"operation\"=>\"%s\","+
		"\"startedTime\"=>\"%d\",\"queuedTime\"=>\"%d\",\"endTime\"=>\"%d\",\"options\"=>%s}",
		s.Sequence, s.State, s.Errors, s.Warnings, s.Operation, s.StartedTime, s.QueuedTime,
		s.EndTime, s.Options)

}
1191628
func Convert_v1_StepInfo_To_build_StepInfo(in *v1.StepInfo, out *build.StepInfo, s conversion.Scope) error {
	return autoConvert_v1_StepInfo_To_build_StepInfo(in, out, s)
}
1258119
func GuideTextForShareCreate(toolMode bool) string {
	name := "stepman"
	if toolMode {
		name = "bitrise"
	}

	b := colorstring.NewBuilder()
	b.Plain("Next, call ").Blue("$ %s share create --tag [step-version-tag] --git [step-git-uri].git --stepid [step-id]", name).Plain(",").NewLine()
	b.Plain("to add your Step to your forked StepLib repository (locally).").NewLine()
	b.NewLine()
	b.Yellow("Important: ").Plain("you have to add the (version) tag to your Step's repository.")
	return b.String()
}