Class: RubyCritic::SourceControlSystem::Mercurial

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

connected_system_names, create, register_system, systems

Class Method Details

.supported?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/rubycritic/source_control_systems/mercurial.rb', line 8

def self.supported?
  `hg verify 2>&1` && $CHILD_STATUS.success?
end

.to_sObject



12
13
14
# File 'lib/rubycritic/source_control_systems/mercurial.rb', line 12

def self.to_s
  'Mercurial'
end

Instance Method Details

#date_of_last_commit(path) ⇒ Object



20
21
22
# File 'lib/rubycritic/source_control_systems/mercurial.rb', line 20

def date_of_last_commit(path)
  `hg log #{path.shellescape} --template '{date|isodate}' --limit 1`.chomp
end

#revision?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/rubycritic/source_control_systems/mercurial.rb', line 24

def revision?
  false
end

#revisions_count(path) ⇒ Object



16
17
18
# File 'lib/rubycritic/source_control_systems/mercurial.rb', line 16

def revisions_count(path)
  `hg log #{path.shellescape} --template '1'`.size
end