Class: Disloku::Git::Repository

Inherits:
Repository show all
Defined in:
lib/disloku/git/Repository.rb

Instance Attribute Summary

Attributes inherited from Repository

#location, #root

Instance Method Summary collapse

Methods inherited from Repository

#getChangeSets

Constructor Details

#initialize(location) ⇒ Repository

Returns a new instance of Repository.



8
9
10
# File 'lib/disloku/git/Repository.rb', line 8

def initialize(location)
	super(location)
end

Instance Method Details

#getBranchNameObject



21
22
23
24
25
26
# File 'lib/disloku/git/Repository.rb', line 21

def getBranchName()
	return @branch || begin
		branch = SysCmd.new("git --git-dir=\"#{@gitDir}\" rev-parse --abbrev-ref HEAD").execute()
		@branch = branch.output.strip()
	end
end

#getHashOfRefspec(refspec) ⇒ Object



28
29
30
31
# File 'lib/disloku/git/Repository.rb', line 28

def getHashOfRefspec(refspec)
	hash = SysCmd.new("git --git-dir=\"#{@gitDir}\" rev-parse #{refspec}").execute()
	return hash.output.strip()
end

#getHeadHashObject



33
34
35
36
37
38
# File 'lib/disloku/git/Repository.rb', line 33

def getHeadHash()
	return @headHash || begin
		headHash = SysCmd.new("git --git-dir=\"#{@gitDir}\" rev-parse HEAD").execute()
		@headHash = branch.output.strip()
	end
end

#getProviderObject



40
41
42
# File 'lib/disloku/git/Repository.rb', line 40

def getProvider()
	return ChangeSetProvider.new(self)
end

#getRepositoryRootObject



12
13
14
15
16
17
18
19
# File 'lib/disloku/git/Repository.rb', line 12

def getRepositoryRoot()
	old = Dir.pwd()
	Dir.chdir(location)
	status = SysCmd.new("git rev-parse --show-toplevel").execute()
	Dir.chdir(old)

	return status.output.strip()
end