Class: SourceControl::Mercurial

Inherits:
Base
  • Object
show all
Defined in:
lib/source_control/mercurial.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#get_remote_info, #initialize, #shell

Constructor Details

This class inherits a constructor from SourceControl::Base

Class Method Details

.covers?(path) ⇒ Boolean

Returns:

  • (Boolean)


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

def self.covers?(path)
  path_parts = path.split('/')
  path_parts.length.downto(1) do |n|
    return true if File.exist? path_parts[0...n].join('/') + '/.hg'
  end
  false
end

Instance Method Details

#commandObject



4
# File 'lib/source_control/mercurial.rb', line 4

def command; 'hg' end

#commit(options) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/source_control/mercurial.rb', line 14

def commit(options)
  cmd = 'hg commit'
  options.each do |key, value|
    case key
      when :message
        cmd << " -m '#{value}'"
    end
  end
  run "#{cmd}"
end