Sha256: 06ed0d19526b96762aef3c86fbe10d892c0743654c6eb830bc99a2361d24f5dd
Contents?: true
Size: 1.22 KB
Versions: 7
Compression:
Stored size: 1.22 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 # ID of a commit associated with the branch. 40-chars long SHA1 hash. attr_reader :hash_id def initialize(repository, name, options={}) @repository = repository @name = name @status = options[:status] == 'closed' ? 'closed' : 'active' @hash_id = options[:commit] end def commit repository.commits.by_hash_id(hash_id) end def active? status == 'active' end def closed? status == 'closed' end end end
Version data entries
7 entries across 7 versions & 1 rubygems