Sha256: cd90dba0971c5546ce5a9a941ab891ed862abb2a63ced2b2ad370238a604c309

Contents?: true

Size: 1.18 KB

Versions: 5

Compression:

Stored size: 1.18 KB

Contents

module Mercurial
  
  #
  # The class represents Mercurial branch. Obtained by running an +hg branches+ command.
  #
  # The class represents Branch object itself, {Mercurial::BranchFactory BranchFactory} is responsible
  # for assembling instances of Branch. For the list of all possible branch-related operations please 
  # look documentation for {Mercurial::BranchFactory BranchFactory}.
  #
  # Read more about Mercurial branches:
  #
  # http://mercurial.selenic.com/wiki/Branch
  #
  class Branch
   
    # Instance of {Mercurial::Repository Repository}.
    attr_reader :repository
    
    # Name of the branch.
    attr_reader :name
    
    # State of the branch: closed or active.
    attr_reader :status
    
    # Mercurial changeset ID of the latest commit in the branch. 40-chars long SHA1 hash.
    attr_reader :latest_commit
    
    def initialize(repository, name, options={})
      @repository    = repository
      @name          = name
      @status        = options[:status] == 'closed' ? 'closed' : 'active'
      @latest_commit = options[:commit]
    end
    
    def active?
      status == 'active'
    end
    
    def closed?
      status == 'closed'
    end
    
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mercurial-ruby-0.6.1 lib/mercurial-ruby/branch.rb
mercurial-ruby-0.6.0 lib/mercurial-ruby/branch.rb
mercurial-ruby-0.5.0 lib/mercurial-ruby/branch.rb
mercurial-ruby-0.4.0 lib/mercurial-ruby/branch.rb
mercurial-ruby-0.3.0 lib/mercurial-ruby/branch.rb