Class: Cerberus::SCM::Mercurial

Inherits:
Base
  • Object
show all
Defined in:
lib/cerberus/scm/hg.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, #url

Constructor Details

This class inherits a constructor from Cerberus::SCM::Base

Instance Method Details

#current_revisionObject



39
40
41
# File 'lib/cerberus/scm/hg.rb', line 39

def current_revision
  @revision
end

#has_changes?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/cerberus/scm/hg.rb', line 30

def has_changes?
  @has_changes
end

#installed?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/cerberus/scm/hg.rb', line 6

def installed?
  exec_successful? "#{@config[:bin_path]}hg --version"
end

#last_authorObject



47
48
49
# File 'lib/cerberus/scm/hg.rb', line 47

def last_author
  @author
end

#last_commit_messageObject



43
44
45
# File 'lib/cerberus/scm/hg.rb', line 43

def last_commit_message
  @message
end

#new?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/cerberus/scm/hg.rb', line 35

def new?
  @new
end

#outputObject



51
52
53
# File 'lib/cerberus/scm/hg.rb', line 51

def output
  @status
end

#update!Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cerberus/scm/hg.rb', line 10

def update!
  @new =false
  if test( ?d, File.join( @path,'.hg' ) )
    r = get_localrev
    get_updates
    r_new = get_localrev
    @has_changes = r_new !=r
  else
    FileUtils.rm_rf(@path) if test(?d, @path)
    encoded_url = (@config[:scm, :url].include?(' ') ? "\"#{@config[:scm, :url]}\"" : @config[:scm, :url])
    @new = true
    @has_changes = true
    @status = execute("clone", "#{encoded_url} #{@path}", false)
    if branch = @config[:scm, :branch]
      execute('update', "-C #{branch}")
    end
  end
  extract_commit_info if @has_changes
end