# 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
# File lib/git/branch.rb, line 36
36: def archive(file, opts = {})
37: @base.lib.archive(@full, file, opts)
38: end
# File lib/git/branch.rb, line 31
31: def checkout
32: check_if_create
33: @base.checkout(@full)
34: end
# File lib/git/branch.rb, line 56
56: def create
57: check_if_create
58: end
# File lib/git/branch.rb, line 64
64: def current
65: determine_current
66: end
# File lib/git/branch.rb, line 60
60: def delete
61: @base.lib.branch_delete(@name)
62: end
# File lib/git/branch.rb, line 22
22: def gcommit
23: @gcommit ||= @base.gcommit(@full)
24: @gcommit
25: end
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
# 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
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.