Sha256: 28193dac06a774c9a141df86b03e7e6635131793dae5b5a0e5a467ff4415d77b

Contents?: true

Size: 730 Bytes

Versions: 3

Compression:

Stored size: 730 Bytes

Contents

module OhlohScm::Adapters
	class HgAdapter < AbstractAdapter
		def head_token
			# This only returns first 12 characters.
			# How can we make it return the entire hash?
			token = run("hg id -q #{url}").strip

			# Recent versions of Hg now somtimes append a '+' char to the token.
			# I believe this signifies pending changes... but we don't care.
			# Strip the trailing '+', if any.
			token = token[0..-2] if token[-1..-1] == '+'

			token
		end

		def head
			verbose_commit(head_token)
		end

		def parent_tokens(commit)
			run("cd '#{url}' && hg parents -r #{commit.token} --template '{node}\\n'").split("\n")
		end

		def parents(commit)
			parent_tokens(commit).collect { |token| verbose_commit(token) }
		end
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ohloh_scm-2.1.0 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.0.1 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.0.0 lib/ohloh_scm/adapters/hg/head.rb