// ImageHistory returns the history of a given image
354757
func (c *Cluster) ImageHistory(repo string) ([]docker.ImageHistory, error) {
	img, err := c.storage().RetrieveImage(repo)
	if err != nil {
		return nil, err
	}
	node, err := c.getNodeByAddr(img.LastNode)
	if err != nil {
		return nil, err
	}
	imgHistory, err := node.ImageHistory(repo)
	return imgHistory, wrapError(node, err)
}
389531
func (h *Client) ReleaseHistory(rlsName string, opts ...HistoryOption) (*rls.GetHistoryResponse, error) {
	reqOpts := h.opts
	for _, opt := range opts {
		opt(&reqOpts)
	}

	req := &reqOpts.histReq
	req.Name = rlsName
	ctx := NewContext()

	if reqOpts.before != nil {
		if err := reqOpts.before(ctx, req); err != nil {
			return nil, err
		}
	}
	return h.history(ctx, req)
}
1206001
func (s *AlarmHistoryItem) SetHistoryData(v string) *AlarmHistoryItem {
	s.HistoryData = &v
	return s
}
446932
func (r *RoomService) History(id string, opt *HistoryOptions) (*History, *http.Response, error) {
	u := fmt.Sprintf("room/%s/history", id)
	req, err := r.client.NewRequest("GET", u, opt, nil)
	h := new(History)
	resp, err := r.client.Do(req, &h)
	if err != nil {
		return nil, resp, err
	}
	return h, resp, nil
}
930614
func AddHistory(line string) error { // int linenoiseHistoryAdd(const char *line);
	lineCString := C.CString(line)
	res := C.linenoiseHistoryAdd(lineCString)
	C.free(unsafe.Pointer(lineCString))
	if res != 1 {
		return errors.New("Could not add line to history.")
	}
	return nil
}
706164
func _baseHistory(fname string, size int) (*history, error) {
	file, err := os.OpenFile(fname, os.O_CREATE|os.O_RDWR, HistoryPerm)
	if err != nil {
		return nil, err
	}

	h := new(history)
	h.Cap = size
	h.filename = fname
	h.file = file
	h.li = list.New()

	return h, nil
}
1318658
func gatherImagesFromImageStreamStatus(is *imageapi.ImageStream) sets.String {
	res := sets.NewString()

	for _, history := range is.Status.Tags {
		for i := range history.Items {
			ref := history.Items[i].Image
			if len(ref) == 0 {
				continue
			}

			res.Insert(ref)
		}
	}

	return res
}
302264
func SWFHistoryEventTypes() []string {
	es := make([]string, 0, len(eventTypes))
	for k := range eventTypes {
		es = append(es, k)
	}
	return es
}
240629
func (e *JSONEncoder) EncodeHistoryRemove(res *HistoryRemoveResult) ([]byte, error) {
	return json.Marshal(res)
}
494129
func (b *Bittrex) GetOrderHistory(market string) (orders []Order, err error) {
	resource := "account/getorderhistory"
	if market != "all" {
		resource += "?market=" + market
	}
	r, err := b.client.do("GET", resource, "", true)
	if err != nil {
		return
	}
	var response jsonResponse
	if err = json.Unmarshal(r, &response); err != nil {
		return
	}
	if err = handleErr(response); err != nil {
		return
	}
	err = json.Unmarshal(response.Result, &orders)
	return
}
716957
func (_m *APIClient) ImageHistory(ctx context.Context, _a1 string) ([]image.HistoryResponseItem, error) {
	ret := _m.Called(ctx, _a1)

	var r0 []image.HistoryResponseItem
	if rf, ok := ret.Get(0).(func(context.Context, string) []image.HistoryResponseItem); ok {
		r0 = rf(ctx, _a1)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]image.HistoryResponseItem)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
		r1 = rf(ctx, _a1)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
1156925
func HistoryFromConfig(imageJSON []byte, emptyLayer bool) (image.History, error) {
	h := image.History{}
	var v1Image image.V1Image
	if err := json.Unmarshal(imageJSON, &v1Image); err != nil {
		return h, err
	}

	return image.History{
		Author:     v1Image.Author,
		Created:    v1Image.Created,
		CreatedBy:  strings.Join(v1Image.ContainerConfig.Cmd, " "),
		Comment:    v1Image.Comment,
		EmptyLayer: emptyLayer,
	}, nil
}
890234
func (h *DeploymentHistoryViewer) ViewHistory(namespace, name string, revision int64) (string, error) {
	versionedAppsClient := h.c.AppsV1()
	deployment, err := versionedAppsClient.Deployments(namespace).Get(name, metav1.GetOptions{})
	if err != nil {
		return "", fmt.Errorf("failed to retrieve deployment %s: %v", name, err)
	}
	_, allOldRSs, newRS, err := deploymentutil.GetAllReplicaSets(deployment, versionedAppsClient)
	if err != nil {
		return "", fmt.Errorf("failed to retrieve replica sets from deployment %s: %v", name, err)
	}
	allRSs := allOldRSs
	if newRS != nil {
		allRSs = append(allRSs, newRS)
	}

	historyInfo := make(map[int64]*corev1.PodTemplateSpec)
	for _, rs := range allRSs {
		v, err := deploymentutil.Revision(rs)
		if err != nil {
			continue
		}
		historyInfo[v] = &rs.Spec.Template
		changeCause := getChangeCause(rs)
		if historyInfo[v].Annotations == nil {
			historyInfo[v].Annotations = make(map[string]string)
		}
		if len(changeCause) > 0 {
			historyInfo[v].Annotations[ChangeCauseAnnotation] = changeCause
		}
	}

	if len(historyInfo) == 0 {
		return "No rollout history found.", nil
	}

	if revision > 0 {
		// Print details of a specific revision
		template, ok := historyInfo[revision]
		if !ok {
			return "", fmt.Errorf("unable to find the specified revision")
		}
		return printTemplate(template)
	}

	// Sort the revisionToChangeCause map by revision
	revisions := make([]int64, 0, len(historyInfo))
	for r := range historyInfo {
		revisions = append(revisions, r)
	}
	sliceutil.SortInts64(revisions)

	return tabbedString(func(out io.Writer) error {
		fmt.Fprintf(out, "REVISION\tCHANGE-CAUSE\n")
		for _, r := range revisions {
			// Find the change-cause of revision r
			changeCause := historyInfo[r].Annotations[ChangeCauseAnnotation]
			if len(changeCause) == 0 {
				changeCause = "<none>"
			}
			fmt.Fprintf(out, "%d\t%s\n", r, changeCause)
		}
		return nil
	})
}
1137393
func (e *JSONEncoder) EncodeHistory(res *HistoryResult) ([]byte, error) {
	return json.Marshal(res)
}
933161
func (api *Client) GetGroupHistory(group string, params HistoryParameters) (*History, error) {
	return api.GetGroupHistoryContext(context.Background(), group, params)
}
1355769
func NewHistory(author, comment, createdBy string, isEmptyLayer bool) History {
	return History{
		Author:     author,
		Created:    time.Now().UTC(),
		CreatedBy:  createdBy,
		Comment:    comment,
		EmptyLayer: isEmptyLayer,
	}
}
940399
func PrettyHistoryEvent(h *swf.HistoryEvent) string {
	var buffer bytes.Buffer
	buffer.WriteString("HistoryEvent{ ")
	if h.EventId != nil {
		buffer.WriteString(fmt.Sprintf("EventId: %d,", *h.EventId))
	}
	if h.EventTimestamp != nil {
		buffer.WriteString(fmt.Sprintf("EventTimestamp: %s, ", *h.EventTimestamp))
	}
	if h.EventType != nil {
		buffer.WriteString(fmt.Sprintf("EventType: %s,", *h.EventType))
	}
	buffer.WriteString(fmt.Sprintf(" %+v", eventTypes[*h.EventType](h)))
	buffer.WriteString(" }")
	return buffer.String()
}