Parent

Files

Git::Branch

Attributes

full[RW]
remote[RW]
name[RW]

Public Class Methods

new(base, name) click to toggle source
    # File lib/git/branch.rb, line 6
 6:     def initialize(base, name)
 7:       @remote = nil
 8:       @full = name
 9:       @base = base
10:       @gcommit = nil
11:       @stashes = nil
12:       
13:       parts = name.split('/')
14:       if parts[1]
15:         @remote = Git::Remote.new(@base, parts[0])
16:         @name = parts[1]
17:       else
18:         @name = parts[0]
19:       end
20:     end

Public Instance Methods

archive(file, opts = {}) click to toggle source
    # File lib/git/branch.rb, line 36
36:     def archive(file, opts = {})
37:       @base.lib.archive(@full, file, opts)
38:     end
checkout() click to toggle source
    # File lib/git/branch.rb, line 31
31:     def checkout
32:       check_if_create
33:       @base.checkout(@full)
34:     end
create() click to toggle source
    # File lib/git/branch.rb, line 56
56:     def create
57:       check_if_create
58:     end
current() click to toggle source
    # File lib/git/branch.rb, line 64
64:     def current
65:       determine_current
66:     end
delete() click to toggle source
    # File lib/git/branch.rb, line 60
60:     def delete
61:       @base.lib.branch_delete(@name)
62:     end
gcommit() click to toggle source
    # File lib/git/branch.rb, line 22
22:     def gcommit
23:       @gcommit ||= @base.gcommit(@full)
24:       @gcommit
25:     end
in_branch(message = 'in branch work') click to toggle source

g.branch(‘new_branch’).in_branch do

  # create new file
  # do other stuff
  return true # auto commits and switches back

end

    # File lib/git/branch.rb, line 45
45:     def in_branch (message = 'in branch work')
46:       old_current = @base.lib.branch_current
47:       checkout
48:       if yield
49:         @base.commit_all(message)
50:       else
51:         @base.reset_hard
52:       end
53:       @base.checkout(old_current)
54:     end
merge(branch = nil, message = nil) click to toggle source
    # File lib/git/branch.rb, line 68
68:     def merge(branch = nil, message = nil)
69:       if branch
70:         in_branch do 
71:           @base.merge(branch, message)
72:           false
73:         end
74:         # merge a branch into this one
75:       else
76:         # merge this branch into the current one
77:         @base.merge(@name)
78:       end
79:     end
stashes() click to toggle source
    # File lib/git/branch.rb, line 27
27:     def stashes
28:       @stashes ||= Git::Stashes.new(@base)
29:     end
to_a() click to toggle source
    # File lib/git/branch.rb, line 85
85:     def to_a
86:       [@full]
87:     end
to_s() click to toggle source
    # File lib/git/branch.rb, line 89
89:     def to_s
90:       @full
91:     end
update_ref(commit) click to toggle source
    # File lib/git/branch.rb, line 81
81:     def update_ref(commit)
82:       @base.lib.update_ref(@full, commit)
83:     end

Private Instance Methods

check_if_create() click to toggle source
    # File lib/git/branch.rb, line 95
95:       def check_if_create
96:         @base.lib.branch_new(@name) rescue nil
97:       end
determine_current() click to toggle source
     # File lib/git/branch.rb, line 99
 99:       def determine_current
100:         @base.lib.branch_current == @name
101:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.