Sha256: 7c64c2e118eef94aa3fe08bb7a59cf738927c2b54e78ec29b235b09d9b07e92b
Contents?: true
Size: 1.21 KB
Versions: 4
Compression:
Stored size: 1.21 KB
Contents
class GitCleanup class Branch include Comparable def self.remote(repo) repo.remotes.map { |r| new(repo, r) } end attr_reader :remote, :name, :ref def initialize(repo, ref) @repo = repo @ref = ref @remote, @name = ref.name.split('/', 2) end def to_s "#{remote}/#{name}" end def diff(ref) @repo.git.native(:diff, {}, "#{ref.commit.sha}...#{@ref.commit.sha}") end def commits(ref) @repo.git.native(:log, {}, "#{ref.commit.sha}..#{@ref.commit.sha}") end def commit @ref.commit end def delete(local_branches = nil) Formatador.display('[red]Deleting...[/]') @repo.git.native(:push, {}, @remote, ":#{@name}") Formatador.display_line('[red]done[/]') if local_branches && local_branches.include?(name) Helper.boolean "There is also a local branch called #{name}. Would you like to delete that too?" do Formatador.display('[red]Deleting...[/]') @repo.git.native(:branch, {}, '-d', name) Formatador.display_line('[red]done[/]') end end end def <=>(other) commit.committed_date <=> other.commit.committed_date end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
git-cleanup-0.2.3 | lib/git-cleanup/branch.rb |
git-cleanup-0.2.2 | lib/git-cleanup/branch.rb |
git-cleanup-0.2.1 | lib/git-cleanup/branch.rb |
git-cleanup-0.2.0 | lib/git-cleanup/branch.rb |