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)


6
7
8
# File 'lib/rubycritic/source_control_systems/mercurial.rb', line 6

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

.to_sObject



10
11
12
# File 'lib/rubycritic/source_control_systems/mercurial.rb', line 10

def self.to_s
  'Mercurial'
end

Instance Method Details

#date_of_last_commit(path) ⇒ Object



18
19
20
# File 'lib/rubycritic/source_control_systems/mercurial.rb', line 18

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

#revision?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/rubycritic/source_control_systems/mercurial.rb', line 22

def revision?
  false
end

#revisions_count(path) ⇒ Object



14
15
16
# File 'lib/rubycritic/source_control_systems/mercurial.rb', line 14

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