diff options
| author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-10-18 21:46:05 +0200 |
|---|---|---|
| committer | Yorick Peterse <yorickpeterse@gmail.com> | 2017-11-07 23:25:03 +0100 |
| commit | 6e242e82237ad2cf362098f3f42f4a9dd1a4ad27 (patch) | |
| tree | 415639ff14183a4914dac69fcc400806cb477525 /lib/github/representation/branch.rb | |
| parent | 4dfe26cd8b6863b7e6c81f5c280cdafe9b6e17b6 (diff) | |
| download | gitlab-ce-github-importer-refactor.tar.gz | |
Replace old GH importer with the parallel importergithub-importer-refactor
Diffstat (limited to 'lib/github/representation/branch.rb')
| -rw-r--r-- | lib/github/representation/branch.rb | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/lib/github/representation/branch.rb b/lib/github/representation/branch.rb deleted file mode 100644 index 0087a3d3c4f..00000000000 --- a/lib/github/representation/branch.rb +++ /dev/null @@ -1,55 +0,0 @@ -module Github - module Representation - class Branch < Representation::Base - attr_reader :repository - - def user - raw.dig('user', 'login') || 'unknown' - end - - def repo? - raw['repo'].present? - end - - def repo - return unless repo? - - @repo ||= Github::Representation::Repo.new(raw['repo']) - end - - def ref - raw['ref'] - end - - def sha - raw['sha'] - end - - def short_sha - Commit.truncate_sha(sha) - end - - def valid? - sha.present? && ref.present? - end - - def restore!(name) - repository.create_branch(name, sha) - rescue Gitlab::Git::Repository::InvalidRef => e - Rails.logger.error("#{self.class.name}: Could not restore branch #{name}: #{e}") - end - - def remove!(name) - repository.delete_branch(name) - rescue Gitlab::Git::Repository::DeleteBranchError => e - Rails.logger.error("#{self.class.name}: Could not remove branch #{name}: #{e}") - end - - private - - def repository - @repository ||= options.fetch(:repository) - end - end - end -end |
