Class Grit::CommitDb
In: lib/grit/git-ruby/commit_db.rb
Parent: Object

Methods

Constants

SCHEMA_VERSION = 1

Attributes

db  [RW] 
git  [RW] 

Public Class methods

[Source]

    # File lib/grit/git-ruby/commit_db.rb, line 12
12:       def initialize(git_obj, index_location = nil)
13:         @git = git_obj
14:         db_file = File.join(index_location || @git.git_dir, 'commit_db')
15:         if !File.exists?(db_file)
16:           @db = Sequel.open "sqlite:///#{db_file}"
17:           setup_tables
18:         else
19:           @db = Sequel.open "sqlite:///#{db_file}"
20:         end
21:       end

Public Instance methods

[Source]

    # File lib/grit/git-ruby/commit_db.rb, line 23
23:       def rev_list(branch, options)
24:       end

[Source]

    # File lib/grit/git-ruby/commit_db.rb, line 35
35:       def setup_tables
36:         @db << "create table meta (meta_key text, meta_value text)"
37:         @db[:meta] << {:meta_key => 'schema', :meta_value => SCHEMA_VERSION}
38:         
39:         @db << "create table commits (id integer, sha text, author_date integer)"
40:         @db << "create table nodes (id integer, path text, type text)"
41:         @db << "create table branches (id integer, ref text, commit_id integer)"
42:         
43:         @db << "create table commit_branches (commit_id integer, branch_id integer)"
44:         @db << "create table commit_nodes (commit_id integer, node_id integer, node_sha string)"        
45:       end

[Source]

    # File lib/grit/git-ruby/commit_db.rb, line 26
26:       def update_db(branch = nil)
27:         # find all refs/heads, for each
28:         # add branch if not there
29:         # go though all commits in branch
30:           # add new commit_branches a
31:           # and commit_nodes for each new one
32:           # stop if reach commit that already has branch and node links
33:       end

[Validate]