@ -21,6 +21,8 @@ import (
// CompareInfo represents needed information for comparing references.
// CompareInfo represents needed information for comparing references.
type CompareInfo struct {
type CompareInfo struct {
MergeBase string
MergeBase string
BaseCommitID string
HeadCommitID string
Commits * list . List
Commits * list . List
NumFiles int
NumFiles int
}
}
@ -66,8 +68,18 @@ func (repo *Repository) GetCompareInfo(basePath, baseBranch, headBranch string)
}
}
compareInfo := new ( CompareInfo )
compareInfo := new ( CompareInfo )
compareInfo . HeadCommitID , err = GetFullCommitID ( repo . Path , headBranch )
if err != nil {
compareInfo . HeadCommitID = headBranch
}
compareInfo . MergeBase , remoteBranch , err = repo . GetMergeBase ( tmpRemote , baseBranch , headBranch )
compareInfo . MergeBase , remoteBranch , err = repo . GetMergeBase ( tmpRemote , baseBranch , headBranch )
if err == nil {
if err == nil {
compareInfo . BaseCommitID , err = GetFullCommitID ( repo . Path , remoteBranch )
if err != nil {
compareInfo . BaseCommitID = remoteBranch
}
// We have a common base - therefore we know that ... should work
// We have a common base - therefore we know that ... should work
logs , err := NewCommand ( "log" , compareInfo . MergeBase + "..." + headBranch , prettyLogFormat ) . RunInDirBytes ( repo . Path )
logs , err := NewCommand ( "log" , compareInfo . MergeBase + "..." + headBranch , prettyLogFormat ) . RunInDirBytes ( repo . Path )
if err != nil {
if err != nil {
@ -83,6 +95,7 @@ func (repo *Repository) GetCompareInfo(basePath, baseBranch, headBranch string)
if err != nil {
if err != nil {
compareInfo . MergeBase = remoteBranch
compareInfo . MergeBase = remoteBranch
}
}
compareInfo . BaseCommitID = compareInfo . MergeBase
}
}
// Count number of changed files.
// Count number of changed files.