ruby-hglib /

Ruby interface to Mercurial

Hglib provides a handy way to communicate with Mercurial VCS.

It uses command server protocol in order to reduce the overhead of the command execution.


require 'hglib'

# configure hg executable (optional)
Hglib.configure do
  set :hg_root, '/usr/bin/hg'
end '/path/to/repo' do |hg|

  # prints revision numbers
  hg.log do |cs|
    puts cs.rev

  # If no block given, returns result as array
  rev5 = hg.log(:rev => 5).first

end  # invokes hg.close