Class: Git::Remote

Inherits:
Path
  • Object
show all
Defined in:
lib/git/remote.rb

Instance Attribute Summary collapse

Attributes inherited from Path

#path

Instance Method Summary collapse

Methods inherited from Path

#readable?, #writable?

Constructor Details

#initialize(base, name) ⇒ Remote

Returns a new instance of Remote.



6
7
8
9
10
11
12
# File 'lib/git/remote.rb', line 6

def initialize(base, name)
  @base = base
  config = @base.lib.config_remote(name)
  @name = name
  @url = config['url']
  @fetch_opts = config['fetch']
end

Instance Attribute Details

#fetch_opts

Returns the value of attribute fetch_opts.



4
5
6
# File 'lib/git/remote.rb', line 4

def fetch_opts
  @fetch_opts
end

#name

Returns the value of attribute name.



4
5
6
# File 'lib/git/remote.rb', line 4

def name
  @name
end

#url

Returns the value of attribute url.



4
5
6
# File 'lib/git/remote.rb', line 4

def url
  @url
end

Instance Method Details

#branch(branch = @base.current_branch)



24
25
26
27
# File 'lib/git/remote.rb', line 24

def branch(branch = @base.current_branch)
  remote_tracking_branch = "#{@name}/#{branch}"
  Git::Branch.new(@base, remote_tracking_branch)
end

#fetch(opts = {})



14
15
16
# File 'lib/git/remote.rb', line 14

def fetch(opts={})
  @base.fetch(@name, opts)
end

#merge(branch = @base.current_branch)

merge this remote locally



19
20
21
22
# File 'lib/git/remote.rb', line 19

def merge(branch = @base.current_branch)
  remote_tracking_branch = "#{@name}/#{branch}"
  @base.merge(remote_tracking_branch)
end

#remove



29
30
31
# File 'lib/git/remote.rb', line 29

def remove
  @base.lib.remote_remove(@name)
end

#to_s



33
34
35
# File 'lib/git/remote.rb', line 33

def to_s
  @name
end