Class: Repository::Subversion
- Inherits:
-
- Object
- ActiveRecord::Base
- Repository::Subversion
- Defined in:
- app/models/repository/subversion.rb
Class Method Summary
Instance Method Summary
- - (Object) fetch_changesets
- - (Object) latest_changesets(path, rev, limit = 10)
-
- (Object) relative_path(path)
Returns a path relative to the url of the repository.
- - (Object) scm_adapter
Methods inherited from
available_scm, #branches, #cat, #committer_ids=, #committers, #default_branch, #diff, #entries, #entry, factory, fetch_changesets, #find_changeset_by_name, #find_committer_user, #latest_changeset, #properties, #root_url=, scan_changesets_for_issue_ids, #scan_changesets_for_issue_ids, #scm, #scm_name, #supports_annotate?, #supports_cat?, #tags, #url=
Methods inherited from ActiveRecord::Base
Class Method Details
+ (Object) scm_name
29 30 31 |
# File 'app/models/repository/subversion.rb', line 29 def self.scm_name 'Subversion' end |
Instance Method Details
- (Object) fetch_changesets
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 71 72 73 74 |
# File 'app/models/repository/subversion.rb', line 43 def fetch_changesets scm_info = scm.info if scm_info # latest revision found in database db_revision = latest_changeset ? latest_changeset.revision.to_i : 0 # latest revision in the repository scm_revision = scm_info.lastrev.identifier.to_i if db_revision < scm_revision logger.debug "Fetching changesets for repository #{url}" if logger && logger.debug? identifier_from = db_revision + 1 while (identifier_from <= scm_revision) # loads changesets by batches of 200 identifier_to = [identifier_from + 199, scm_revision].min revisions = scm.revisions('', identifier_to, identifier_from, :with_paths => true) revisions.reverse_each do |revision| transaction do changeset = Changeset.create(:repository => self, :revision => revision.identifier, :committer => revision., :committed_on => revision.time, :comments => revision.) revision.paths.each do |change| changeset.create_change(change) end unless changeset.new_record? end end unless revisions.nil? identifier_from = identifier_to + 1 end end end end |
- (Object) latest_changesets(path, rev, limit = 10)
33 34 35 36 |
# File 'app/models/repository/subversion.rb', line 33 def latest_changesets(path, rev, limit=10) revisions = scm.revisions(path, rev, nil, :limit => limit) revisions ? changesets.find_all_by_revision(revisions.collect(&:identifier), :order => "committed_on DESC", :include => :user) : [] end |
- (Object) relative_path(path)
Returns a path relative to the url of the repository
39 40 41 |
# File 'app/models/repository/subversion.rb', line 39 def relative_path(path) path.gsub(Regexp.new("^\/?#{Regexp.escape(relative_url)}"), '') end |
- (Object) scm_adapter
25 26 27 |
# File 'app/models/repository/subversion.rb', line 25 def scm_adapter Redmine::Scm::Adapters::SubversionAdapter end |