Beispiel #1
0
func (p githubPresenter) Changes() <-chan presenter.Change {
	if p.cc == nil {
		return nil
	}
	out := make(chan presenter.Change)
	go func() {
		for i := range p.cc.Commits {
			c := p.cc.Commits[len(p.cc.Commits)-1-i] // Reverse order.
			change := presenter.Change{
				Message: presenter.FirstParagraph(*c.Commit.Message),
				URL:     template.URL(*c.HTMLURL),
			}
			if commentCount := c.Commit.CommentCount; commentCount != nil && *commentCount > 0 {
				change.Comments.Count = *commentCount
				change.Comments.URL = template.URL(*c.HTMLURL + "#comments")
			}
			out <- change
		}
		close(out)
	}()
	return out
}
func (g gitilesPresenter) Changes() <-chan presenter.Change {
	// Verify/find Repo.Remote.Revision.
	log := g.log.Log
	for len(log) > 0 && log[0].Commit != g.repo.Remote.Revision {
		log = log[1:]
	}

	out := make(chan presenter.Change)
	go func() {
		for _, commit := range log {
			if commit.Commit == g.repo.Local.Revision {
				break
			}
			out <- presenter.Change{
				Message: presenter.FirstParagraph(commit.Message),
				URL:     template.URL(g.repo.Remote.RepoURL + "/+/" + commit.Commit + "%5e%21"),
			}
		}
		close(out)
	}()
	return out
}