Sha256: 5722e90d844e9cc03f946a8f8bf4aef357ced0970cf0974f626608fd592dc8ce
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 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('/') 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) puts "Deleting..." @repo.git.native(:push, {}, @remote, ":#{@name}") puts "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 puts "Deleting..." @repo.git.native(:branch, {}, '-d', name) puts "Done" end end end def <=>(other) commit.committed_date <=> other.commit.committed_date end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
git-cleanup-0.1.3 | lib/git-cleanup/branch.rb |
git-cleanup-0.1.2 | lib/git-cleanup/branch.rb |