Sha256: d69079464b789e7160fd80d55a8db8955d7ddadaaccc71669686fd02c68e1f2a
Contents?: true
Size: 1.24 KB
Versions: 9
Compression:
Stored size: 1.24 KB
Contents
require 'yaml' module Vendorificator class Commit attr_reader :git, :rev # Public: Initializes the object # # rev - The String containing revision expression for this commit. # git - The MiniGit instance to use. # # Returns Commit object. def initialize(rev, git) @rev = rev @git = git end # Public: Finds branches that contain this commit. # # Returns Array of branch names. def branches git.capturing.branch({:contains => true}, rev).split("\n").map do |name| name.tr('*', '').strip end end # Public: Checks if such a commit exists in the repository. # # Returns Boolean. def exists? git.capturing.rev_parse rev true rescue MiniGit::GitError false end # Public: Returns vendorificator git notes for the commit. # # Returns the notes Hash. def notes YAML.load(git.capturing.notes({:ref => 'vendor'}, 'show', rev)) end # Public: Returns vendorificator git notes for the commit if it exists. # # Returns the notes Hash or an empty one. def notes? if exists? YAML.load(git.capturing.notes({:ref => 'vendor'}, 'show', rev)) else {} end end end end
Version data entries
9 entries across 9 versions & 1 rubygems