mercurial-wrapper
A simple ruby wrapper around mercurial command line tool This gem relies heavily on childprocess, and it is compatible with MRI and JRuby runtimes. Below you will find more information on how to install and use this gem. For more information about all options available please check the specs or dive into the source code
How to install?
gem install mercurial-wrapper
How to run all the tests
rake
How to build the gem
rake build
Examples of usage
Create repository
Dir.mkdir File.join(basedir, REPO_NAME)
repo1 = Mercurial.new(logger).config do |settings|
settings[:basedir] = basedir
settings[:repo_name] = REPO_NAME
end
repo1.init
Clone an existing repository
repo1 = Mercurial.new(logger).config do |settings|
settings[:basedir] = basedir
settings[:repo_name] = REPO_NAME
end
repo1.clone 'https://github.com/datalex-opensource/mercurial-wrapper'
Commit a file
repo1.commit 'module2/File1.java', 'Commit Message', '2013-06-01 00:00:00'
Push changes
repo1.push
Branch a repository (automatically commits)
repo1.create_branch 'branch1', 'Commit message'
Remove File
repo1.remove 'module1/filename'
Add a file
repo1.add 'module1/filename'
Current branch of a given file/module
repo1.current_branch 'module1/filename'
Current revision of a given file
repo1.current_revision 'module1/filename'
Previous revision of a given file
repo1.previous_revision 'module1/filename'
Pull changesets
repo1.pull