コード例 #1
0
ファイル: change_group.go プロジェクト: salsaflow/salsaflow
// StoryChanges returns the list of changes grouped by Story-Id.
func StoryChanges(stories []common.Story) ([]*StoryChangeGroup, error) {
	// Prepare the regexp to use to select commits by commit messages.
	// This regexp is ORing the chosen Story-Id tag values.
	var grepFlag bytes.Buffer
	fmt.Fprintf(&grepFlag, "^Story-Id: (%v", stories[0].Tag())
	for _, story := range stories[1:] {
		fmt.Fprintf(&grepFlag, "|%v", story.Tag())
	}
	fmt.Fprint(&grepFlag, ")$")

	// Get the relevant commits.
	commits, err := git.GrepCommitsCaseInsensitive(grepFlag.String(), "--all")
	if err != nil {
		return nil, err
	}

	okCommits := make([]*git.Commit, 0, len(commits))
	for _, commit := range commits {
		if commit.StoryIdTag == "" {
			log.Warn(fmt.Sprintf(
				"Found story commit %v, but failed to parse the Story-Id tag.", commit.SHA))
			log.NewLine("Please check that commit manually.")
			continue
		}
		okCommits = append(okCommits, commit)
	}
	commits = okCommits

	// Return the change groups.
	return StoryChangesFromCommits(commits)
}
コード例 #2
0
ファイル: command.go プロジェクト: jkotrlik/salsaflow
func collectChanges(pattern string) ([]*changes.StoryChangeGroup, error) {
	// Collect the relevant commits.
	commits, err := git.GrepCommitsCaseInsensitive(
		fmt.Sprintf("^Story-Id: .*%v", pattern), "--all")
	if err != nil {
		return nil, err
	}

	// Group the commits.
	return changes.StoryChangesFromCommits(commits)
}
コード例 #3
0
ファイル: change_group.go プロジェクト: jkotrlik/salsaflow
// StoryChanges returns the list of changes grouped by Story-Id.
func StoryChanges(stories []common.Story) ([]*StoryChangeGroup, error) {
	// Prepare the regexp to use to select commits by commit messages.
	// This regexp is ORing the chosen Story-Id tag values.
	var grepFlag bytes.Buffer
	fmt.Fprintf(&grepFlag, "^Story-Id: (%v", stories[0].Tag())
	for _, story := range stories[1:] {
		fmt.Fprintf(&grepFlag, "|%v", story.Tag())
	}
	fmt.Fprint(&grepFlag, ")$")

	// Get the relevant commits.
	commits, err := git.GrepCommitsCaseInsensitive(grepFlag.String(), "--all")
	if err != nil {
		return nil, err
	}

	// Return the change groups.
	return StoryChangesFromCommits(commits)
}