class Repository::SubversionRevision

Convenience class, so that we can work on Revisions rather than repositories

Public Class Methods

new(revision_number, repo) click to toggle source

Constructor; Check if revision is actually present in repository

# File lib/repo/subversion_repository.rb, line 919
def initialize(revision_number, repo)
  @repo = repo
  begin
    @timestamp = @repo.__get_property(:date, revision_number)
    if @timestamp.instance_of?(String)
      @timestamp = Time.parse(@timestamp).localtime
    elsif @timestamp.instance_of?(Time)
      @timestamp = @timestamp.localtime
    end
  rescue Svn::Error::FsNoSuchRevision
    raise RevisionDoesNotExist
  end
  super(revision_number)
end

Public Instance Methods

changed_files_at_path(path) click to toggle source

Return changed files at ‘path’ (recursively)

# File lib/repo/subversion_repository.rb, line 966
def changed_files_at_path(path)
  return files_at_path_helper(path, true)
end
directories_at_path(path='/') click to toggle source

Return all directories at ‘path’ (including subfolders?!)

# File lib/repo/subversion_repository.rb, line 944
def directories_at_path(path='/')
  result = Hash.new(nil)
  raw_contents = @repo.__get_files(path, @revision_number)
  raw_contents.each do |file_name, type|
    if type == :directory
      last_modified_revision = @repo.__get_history(File.join(path, file_name)).last
      last_modified_date = @repo.__get_node_last_modified_date(File.join(path, file_name), @revision_number)
      new_directory = Repository::RevisionDirectory.new(@revision_number, {
        :name => file_name,
        :path => path,
        :last_modified_revision => last_modified_revision,
        :last_modified_date => last_modified_date,
        :changed => (last_modified_revision == @revision_number),
        :user_id => @repo.__get_property(:author, last_modified_revision)
      })
      result[file_name] = new_directory
    end
  end
  return result
end
files_at_path(path) click to toggle source

Return all of the files in this repository at the root directory

# File lib/repo/subversion_repository.rb, line 935
def files_at_path(path)
  return files_at_path_helper(path)
end
path_exists?(path) click to toggle source
# File lib/repo/subversion_repository.rb, line 939
def path_exists?(path)
  @repo.__path_exists?(path, @revision_number)
end