class Mercurial::Branch
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 check {Mercurial::BranchFactory BranchFactory}.
For general information on Mercurial
branches:
Attributes
hash_id[R]
ID of a commit associated with the branch. 40-chars long SHA1 hash.
name[R]
Name of the branch.
repository[R]
Instance of {Mercurial::Repository Repository}.
status[R]
State of the branch: closed or active.
Public Class Methods
new(repository, name, options={})
click to toggle source
# File lib/mercurial-ruby/branch.rb, line 28 def initialize(repository, name, options={}) @repository = repository @name = name.strip @status = ['closed', 'inactive'].include?(options[:status]) ? options[:status] : 'active' @hash_id = options[:commit] end
Public Instance Methods
active?()
click to toggle source
# File lib/mercurial-ruby/branch.rb, line 39 def active? status == 'active' end
closed?()
click to toggle source
# File lib/mercurial-ruby/branch.rb, line 47 def closed? status == 'closed' end
commit()
click to toggle source
# File lib/mercurial-ruby/branch.rb, line 35 def commit repository.commits.by_hash_id(hash_id) end
inactive?()
click to toggle source
# File lib/mercurial-ruby/branch.rb, line 43 def inactive? status == 'inactive' end