// OpenStory is a part of common.IssueTracker interface.
516074
func (tracker *issueTracker) OpenStory(storyId string) error {
	u := fmt.Sprintf("https://github.com/%v/%v/issues/%v",
		tracker.config.GitHubOwner, tracker.config.GitHubRepository, storyId)

	return webbrowser.Open(u)
}
520843
func AddHistory(s string) {
	n := HistorySize()
	if n == 0 || s != GetHistory(n-1) {
		C.add_history(C.CString(s))
	}
}
1200353
func (s *Session) OpenStream() (*Stream, error) {
	if s.IsClosed() {
		return nil, errors.New(errBrokenPipe)
	}

	// generate stream id
	s.nextStreamIDLock.Lock()
	if s.goAway > 0 {
		s.nextStreamIDLock.Unlock()
		return nil, errors.New(errGoAway)
	}

	s.nextStreamID += 2
	sid := s.nextStreamID
	if sid == sid%2 { // stream-id overflows
		s.goAway = 1
		s.nextStreamIDLock.Unlock()
		return nil, errors.New(errGoAway)
	}
	s.nextStreamIDLock.Unlock()

	stream := newStream(sid, s.config.MaxFrameSize, s)

	if _, err := s.writeFrame(newFrame(cmdSYN, sid)); err != nil {
		return nil, errors.Wrap(err, "writeFrame")
	}

	s.streamLock.Lock()
	defer s.streamLock.Unlock()
	select {
	case <-s.die:
		return nil, errors.New(errBrokenPipe)
	default:
		s.streams[sid] = stream
		return stream, nil
	}
}
151874
func (tracker *issueTracker) ListStoriesByRelease(v *version.Version) ([]common.Story, error) {
	issues, err := tracker.issuesByRelease(v)
	if err != nil {
		return nil, err
	}
	return toCommonStories(issues, tracker), nil
}
550902
func (historyDB *historyDB) NewHistoryQueryExecutor(blockStore blkstorage.BlockStore) (ledger.HistoryQueryExecutor, error) {
	return &LevelHistoryDBQueryExecutor{historyDB, blockStore}, nil
}
758074
func (c *CameraModel) OpenSession() error {
	eosError := C.EdsOpenSession((*C.struct___EdsObject)(unsafe.Pointer(c.camera)))
	if eosError != C.EDS_ERR_OK {
		return errors.New(fmt.Sprintf("Error when opening session with camera (code=%d)", eosError))
	}
	c.sessionOpen = true
	return nil
}
530364
func (h *DaemonSetHistoryViewer) ViewHistory(namespace, name string, revision int64) (string, error) {
	ds, history, err := daemonSetHistory(h.c.AppsV1(), namespace, name)
	if err != nil {
		return "", err
	}
	historyInfo := make(map[int64]*appsv1.ControllerRevision)
	for _, history := range history {
		// TODO: for now we assume revisions don't overlap, we may need to handle it
		historyInfo[history.Revision] = history
	}
	if len(historyInfo) == 0 {
		return "No rollout history found.", nil
	}

	// Print details of a specific revision
	if revision > 0 {
		history, ok := historyInfo[revision]
		if !ok {
			return "", fmt.Errorf("unable to find the specified revision")
		}
		dsOfHistory, err := applyDaemonSetHistory(ds, history)
		if err != nil {
			return "", fmt.Errorf("unable to parse history %s", history.Name)
		}
		return printTemplate(&dsOfHistory.Spec.Template)
	}

	// Print an overview of all Revisions
	// 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
	})
}
779171
func OpenSequential(name string) (*os.File, error) {
	return OpenFileSequential(name, os.O_RDONLY, 0)
}
40765
func (fp FsPath) Open() (ReadCloser, error) {
	return fp.Fs.Open(fp.Path)
}
757817
func (c *Client) StatusHistory(kind status.HistoryKind, tag names.Tag, filter status.StatusHistoryFilter) (status.History, error) {
	var results params.StatusHistoryResults
	args := params.StatusHistoryRequest{
		Kind: string(kind),
		Filter: params.StatusHistoryFilter{
			Size:    filter.Size,
			Date:    filter.FromDate,
			Delta:   filter.Delta,
			Exclude: filter.Exclude.Values(),
		},
		Tag: tag.String(),
	}
	bulkArgs := params.StatusHistoryRequests{Requests: []params.StatusHistoryRequest{args}}
	err := c.facade.FacadeCall("StatusHistory", bulkArgs, &results)
	if err != nil {
		return status.History{}, errors.Trace(err)
	}
	if len(results.Results) != 1 {
		return status.History{}, errors.Errorf("expected 1 result got %d", len(results.Results))
	}
	if results.Results[0].Error != nil {
		return status.History{}, errors.Annotatef(results.Results[0].Error, "while processing the request")
	}
	history := make(status.History, len(results.Results[0].History.Statuses))
	if results.Results[0].History.Error != nil {
		return status.History{}, results.Results[0].History.Error
	}
	for i, h := range results.Results[0].History.Statuses {
		history[i] = status.DetailedStatus{
			Status:  status.Status(h.Status),
			Info:    h.Info,
			Data:    h.Data,
			Since:   h.Since,
			Kind:    status.HistoryKind(h.Kind),
			Version: h.Version,
			// TODO(perrito666) make sure these are still used.
			Life: h.Life,
			Err:  h.Err,
		}
		// TODO(perrito666) https://launchpad.net/bugs/1577589
		if !history[i].Kind.Valid() {
			logger.Errorf("history returned an unknown status kind %q", h.Kind)
		}
	}
	return history, nil
}
1306484
func (connection *redisConnection) OpenQueue(name string) Queue {
	connection.redisClient.SAdd(queuesKey, name)
	queue := newQueue(name, connection.Name, connection.queuesKey, connection.redisClient)
	return queue
}
1310452
func (m *manager) OpenService(name string) (windowsService, error) {
	s, err := mgr.Connect()
	if err != nil {
		return nil, err
	}
	defer s.Disconnect()
	return s.OpenService(name)
}
1170722
func OpenBrowser(ctx context.Context, url string) error {
	var args []string
	switch runtime.GOOS {
	case "darwin":
		args = []string{"open"}
	case "windows":
		args = []string{"cmd", "/c", "start"}
	default:
		args = []string{"xdg-open"}
	}
	cmd := exec.CommandContext(ctx, args[0], append(args[1:], url)...)
	if b, err := cmd.CombinedOutput(); err != nil {
		return errors.Wrapf(err, "astiexec: opening browser failed with body %s", b)
	}
	return nil
}
1154061
func (api *Client) OpenDialogContext(ctx context.Context, triggerID string, dialog Dialog) (err error) {
	if triggerID == "" {
		return ErrParametersMissing
	}

	req := DialogTrigger{
		TriggerID: triggerID,
		Dialog:    dialog,
	}

	encoded, err := json.Marshal(req)
	if err != nil {
		return err
	}

	response := &DialogOpenResponse{}
	endpoint := api.endpoint + "dialog.open"
	if err := postJSON(ctx, api.httpclient, endpoint, api.token, encoded, response, api); err != nil {
		return err
	}

	return response.Err()
}
772025
func (s *SessionStore) OpenSession(c context.Context, userID string, u *auth.User, exp time.Time) (string, error) {
	if strings.IndexByte(s.Prefix, '/') != -1 {
		return "", fmt.Errorf("gaeauth: bad prefix (%q) in SessionStore", s.Prefix)
	}
	if strings.IndexByte(userID, '/') != -1 {
		return "", fmt.Errorf("gaeauth: bad userID (%q), cannot have '/' inside", userID)
	}
	if err := u.Identity.Validate(); err != nil {
		return "", fmt.Errorf("gaeauth: bad identity string (%q) - %s", u.Identity, err)
	}
	c = defaultNS(c)

	now := clock.Now(c).UTC()
	prof := profile{
		Identity:  string(u.Identity),
		Superuser: u.Superuser,
		Email:     u.Email,
		Name:      u.Name,
		Picture:   u.Picture,
	}

	// Set in the transaction below.
	var sessionID string

	err := ds.RunInTransaction(ds.WithoutTransaction(c), func(c context.Context) error {
		// Grab existing userEntity or initialize a new one.
		userEnt := userEntity{ID: s.Prefix + "/" + userID}
		err := ds.Get(c, &userEnt)
		if err != nil && err != ds.ErrNoSuchEntity {
			return err
		}
		if err == ds.ErrNoSuchEntity {
			userEnt.Profile = prof
			userEnt.Created = now
		}
		userEnt.LastLogin = now

		// Make new session. ID will be generated by the datastore.
		sessionEnt := sessionEntity{
			Parent:     ds.KeyForObj(c, &userEnt),
			Profile:    prof,
			Created:    now,
			Expiration: exp.UTC(),
		}
		if err = ds.Put(c, &userEnt, &sessionEnt); err != nil {
			return err
		}

		sessionID = fmt.Sprintf("%s/%s/%d", s.Prefix, userID, sessionEnt.ID)
		return nil
	}, nil)

	if err != nil {
		return "", transient.Tag.Apply(err)
	}
	return sessionID, nil
}
31859
func (v *View) History() (*HistoryProvider, error) {
	if v.history == nil {
		return nil, errors.New("No HistoryProvider")
	}
	return v.history, nil
}
540786
func (i *Image) openDestinationsForWriting() (io.WriteCloser, error) {
	targetFilenames := i.targetFilenames()
	var changedFilenames []string

	// Fast path:
	// This is a processed version of the original;
	// check if it already existis at the destination.
	for _, targetFilename := range targetFilenames {
		if _, err := i.spec.BaseFs.PublishFs.Stat(targetFilename); err == nil {
			continue
		}
		changedFilenames = append(changedFilenames, targetFilename)
	}

	if len(changedFilenames) == 0 {
		return nil, nil
	}

	return helpers.OpenFilesForWriting(i.spec.BaseFs.PublishFs, changedFilenames...)

}