Class: Repository::Git
- Inherits:
-
Repository
- Object
- ActiveRecord::Base
- Repository
- Repository::Git
show all
- Defined in:
- app/models/repository/git.rb
Class Method Summary
(collapse)
Instance Method Summary
(collapse)
Methods inherited from Repository
available_scm, #cat, #committer_ids=, #committers, #diff, #entries, #entry, factory, fetch_changesets, #find_committer_user, #latest_changeset, #properties, #relative_path, #root_url=, scan_changesets_for_issue_ids, #scan_changesets_for_issue_ids, #scm, #scm_name, #supports_annotate?, #supports_cat?, #url=
Class Method Details
+ (Object) scm_name
28
29
30
|
# File 'app/models/repository/git.rb', line 28
def self.scm_name
'Git'
end
|
Instance Method Details
- (Object) changesets_for_path(path, options = {})
32
33
34
35
36
37
|
# File 'app/models/repository/git.rb', line 32
def changesets_for_path(path, options={})
Change.find(:all, :include => {:changeset => :user},
:conditions => ["repository_id = ? AND path = ?", id, path],
:order => "committed_on DESC, #{Changeset.table_name}.revision DESC",
:limit => options[:limit]).collect(&:changeset)
end
|
- (Object) fetch_changesets
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'app/models/repository/git.rb', line 39
def fetch_changesets
scm_info = scm.info
if scm_info
db_revision = latest_changeset ? latest_changeset.revision : nil
scm_revision = scm_info.lastrev.scmid
unless changesets.find_by_scmid(scm_revision)
scm.revisions('', db_revision, nil, :reverse => true) do |revision|
if changesets.find_by_scmid(revision.scmid.to_s).nil?
transaction do
changeset = Changeset.create!(:repository => self,
:revision => revision.identifier,
:scmid => revision.scmid,
:committer => revision.author,
:committed_on => revision.time,
:comments => revision.message)
revision.paths.each do |change|
Change.create!(:changeset => changeset,
:action => change[:action],
:path => change[:path],
:from_path => change[:from_path],
:from_revision => change[:from_revision])
end
end
end
end
end
end
end
|
- (Object) scm_adapter
24
25
26
|
# File 'app/models/repository/git.rb', line 24
def scm_adapter
Redmine::Scm::Adapters::GitAdapter
end
|