Skip to content

Instantly share code, notes, and snippets.

@windix
Created November 20, 2013 20:20
Show Gist options
  • Save windix/7570302 to your computer and use it in GitHub Desktop.
Save windix/7570302 to your computer and use it in GitHub Desktop.
wfeng@mbp  ~  which hg
/usr/local/share/python/hg
Mercurial.configure do |conf|
conf.hg_binary_path = "/usr/local/share/python/hg"
end
repo = Mercurial::Repository.open("/Users/wfeng/work_local/www/betslip")
repo.branches.active.collect { |b| { :name => b.name, :hash_id => b.hash_id, :selected => ["HEAD", "default"].include?(b.name) } }
repo.tags.all.collect { |t| { :name => t.name, :hash_id => t.hash_id, :selected => false } }
3d9e46850900
6f3bc4f7aa97
old => new
hg diff -r 6f3bc4f7aa97 -r 3d9e46850900
commit = repo.commits.by_hash_id('3d9e46850900')
repo.diffs.for_commit(commit).first.body
3d9e46850900
1753aede0b1a
repo.commits.for_range('1753aede0b1a', '3d9e46850900')
repo.commits.for_range('1753aede0b1a', '3d9e46850900').collect { |c| { :message => c.message, :is_merge => c.merge? } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment