Sha256: 4e969c5da4c5a85769c2633376f27e8b3425acd3cc44bc3146c178dace74ec5e
Contents?: true
Size: 1.91 KB
Versions: 8
Compression:
Stored size: 1.91 KB
Contents
# # Copyright (C) 2010-2016 dtk contributors # # This file is part of the dtk project. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # require File.expand_path('../../git_repo.rb',File.dirname(__FILE__)) require 'rugged' module DtkCommon class GitRepo; class Adapter class Rugged require File.expand_path('rugged/common',File.dirname(__FILE__)) require File.expand_path('rugged/commit',File.dirname(__FILE__)) require File.expand_path('rugged/tree',File.dirname(__FILE__)) require File.expand_path('rugged/blob',File.dirname(__FILE__)) include CommonMixin def initialize(repo_path,branch=nil) if branch.nil? raise Error.new("Not implemented yet creating Rugged adapter w/o a branch") end @repo_branch = Branch.new(::Rugged::Repository.new(repo_path),branch) end def get_file_content(path) get_tree().get_file_content(path) end def list_files() get_tree().list_files() end private def get_tree() get_commit().tree() end def get_commit() if rugged_ref = rugged_repo().refs.find {|ref|ref.name == "refs/heads/#{branch}"} Commit.new(@repo_branch,lookup(rugged_ref.target)) else raise ErrorUsage.new("Branch (#{branch} not found in repo (#{pp_repo()})") end end def pp_repo() rugged_repo().path() end end end; end end
Version data entries
8 entries across 8 versions & 1 rubygems