Sha256: 54e07fc17ec68232e6a0534fc5c677b444aab2d174b5174ce991b9d94a984a20

Contents?: true

Size: 1.45 KB

Versions: 1

Compression:

Stored size: 1.45 KB

Contents

require 'scm/commits/commit'

module SCM
  module Commits
    #
    # Represents a commit in an {SCM::Hg Hg Repository}.
    #
    class Hg < Commit

      # The Hash of the commit
      attr_reader :hash

      # The branch of the commit
      attr_reader :branch

      #
      # Creates a new Hg commit.
      #
      # @param [String, Integer] revision
      #   The revision of the commit.
      #
      # @param [String] hash
      #   The hash of the commit.
      #
      # @param [String] branch
      #   The branch the commit belongs to.
      #
      # @param [String] user
      #   The Hg user that made the commit.
      #
      # @param [Time] date
      #   The date the commit was made on.
      #
      # @param [String] summary
      #   The summary of the commit.
      #
      def initialize(revision,hash,branch,user,date,summary,message,files)
        super(revision,date,user,summary,message,files)

        @hash   = hash
        @branch = branch
      end

      alias revision commit
      alias user author

      #
      # Converts the commit to an Integer.
      #
      # @return [Integer]
      #   The commit revision.
      #
      def to_i
        @commit.to_i
      end

      #
      # Coerces the Hg commit into an Array.
      #
      # @return [Array<commit, hash, branch, date, author, summary>]
      #   The commit components.
      #
      def to_ary
        [@commit, @hash, @branch, @date, @user, @summary]
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scm-0.1.0.pre2 lib/scm/commits/hg.rb