|
|
@ -28,8 +28,8 @@ const ( |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
// GetRawDiff dumps diff results of repository in given commit ID to io.Writer.
|
|
|
|
// GetRawDiff dumps diff results of repository in given commit ID to io.Writer.
|
|
|
|
func GetRawDiff(ctx context.Context, repoPath, commitID string, diffType RawDiffType, writer io.Writer) error { |
|
|
|
func GetRawDiff(repo *Repository, commitID string, diffType RawDiffType, writer io.Writer) error { |
|
|
|
return GetRawDiffForFile(ctx, repoPath, "", commitID, diffType, "", writer) |
|
|
|
return GetRepoRawDiffForFile(repo, "", commitID, diffType, "", writer) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// GetReverseRawDiff dumps the reverse diff results of repository in given commit ID to io.Writer.
|
|
|
|
// GetReverseRawDiff dumps the reverse diff results of repository in given commit ID to io.Writer.
|
|
|
@ -46,17 +46,6 @@ func GetReverseRawDiff(ctx context.Context, repoPath, commitID string, writer io |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// GetRawDiffForFile dumps diff results of file in given commit ID to io.Writer.
|
|
|
|
|
|
|
|
func GetRawDiffForFile(ctx context.Context, repoPath, startCommit, endCommit string, diffType RawDiffType, file string, writer io.Writer) error { |
|
|
|
|
|
|
|
repo, closer, err := RepositoryFromContextOrOpen(ctx, repoPath) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
return fmt.Errorf("RepositoryFromContextOrOpen: %v", err) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
defer closer.Close() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return GetRepoRawDiffForFile(repo, startCommit, endCommit, diffType, file, writer) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// GetRepoRawDiffForFile dumps diff results of file in given commit ID to io.Writer according given repository
|
|
|
|
// GetRepoRawDiffForFile dumps diff results of file in given commit ID to io.Writer according given repository
|
|
|
|
func GetRepoRawDiffForFile(repo *Repository, startCommit, endCommit string, diffType RawDiffType, file string, writer io.Writer) error { |
|
|
|
func GetRepoRawDiffForFile(repo *Repository, startCommit, endCommit string, diffType RawDiffType, file string, writer io.Writer) error { |
|
|
|
commit, err := repo.GetCommit(endCommit) |
|
|
|
commit, err := repo.GetCommit(endCommit) |
|
|
|