lib/autobuild/import/git.rb
# Computes the update status to update a branch whose tip is at
# reference_commit (which can be a symbolic reference) using the
# fetch_commit commit
#
# I.e. this compute what happens if one would do
#
#   git checkout reference_commit
#   git merge fetch_commit
#
Computes the update status to update a branch whose tip is at
reference_commit (which can be a symbolic reference) using the
fetch_commit commit




Computes the update status to update a branch whose tip is at reference_commit ( which can be a symbolic reference ) using the fetch_commit commit
def merge_status(package, fetch_commit, reference_commit = "HEAD")
            common_commit = `git merge-base #{reference_commit} #{fetch_commit}`.chomp
            if $?.exitstatus != 0
                raise PackageException.new(package, 'import'), "failed to find the merge-base between #{reference_commit} and #{fetch_commit}. Are you sure these commits exist ?"
            end
            head_commit   = `git rev-parse #{reference_commit}`.chomp
            if $?.exitstatus != 0
                raise PackageException.new(package, 'import'), "failed to resolve #{reference_commit}. Are you sure this commit, branch or tag exists ?"
            end
            status = if common_commit != fetch_commit
                         if common_commit == head_commit
                             Status::SIMPLE_UPDATE
                         else
                             Status::NEEDS_MERGE
                         end
                     else
                         if common_commit == head_commit
                             Status::UP_TO_DATE
                         else
                             Status::ADVANCED
                         end
                     end
            Status.new(status, fetch_commit, head_commit, common_commit)
        end
def merge_status ( package , fetch_commit , reference_commit = "HEAD" ) common_commit = ` git merge-base  #{ reference_commit } #{ fetch_commit } ` . chomp if $? . exitstatus != 0 raise PackageException . new ( package , 'import' ) , "failed to find the merge-base between #{reference_commit} and #{fetch_commit}. Are you sure these commits exist ?" end head_commit = ` git rev-parse  #{ reference_commit } ` . chomp if $? . exitstatus != 0 raise PackageException . new ( package , 'import' ) , "failed to resolve #{reference_commit}. Are you sure this commit, branch or tag exists ?" end status = if common_commit != fetch_commit if common_commit == head_commit Status :: SIMPLE_UPDATE else Status :: NEEDS_MERGE end else if common_commit == head_commit Status :: UP_TO_DATE else Status :: ADVANCED end end Status . new ( status , fetch_commit , head_commit , common_commit ) end
Computes the update status to update a branch whose tip is at
reference_commit (which can be a symbolic reference) using the
fetch_commit commit
Computes the update status to update a branch whose tip is at reference_commit ( which can be a symbolic reference ) using the fetch_commit commit
package
<not_specific>
fetch_commit
<not_specific>
reference_commit
<not_specific>