[NEW] Adding Bazaar support: Add commits.rb and head.rb adapter modules with unit...
[obnox/ohloh/ohloh_scm.git] / lib / scm / adapters / bzr / head.rb
1 module Scm::Adapters
2         class BzrAdapter < AbstractAdapter
3                 def head_token
4                         run("bzr revno -q #{url}").strip
5                 end
6
7                 def head
8                         verbose_commit(head_token)
9                 end
10
11                 def parent_tokens(commit)
12                         run("cd '#{url}' && bzr log -c $((#{commit.token} - 1)) --log-format=line | cut -f1 -d':'").split("\n")
13                 end
14
15                 def parents(commit)
16                         parent_tokens(commit).collect { |token| verbose_commit(token) }
17                 end
18         end
19 end