Overview

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.

Usage

require 'hglib'

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

Hglib.open '/path/to/repo' do |hg|

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

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

end  # invokes hg.close