Sha256: ee7573c31138614c4f7c6a1b3d7375c1bd4280e5e99c45e4031e8c2b75c2f5fa

Contents?: true

Size: 810 Bytes

Versions: 1

Compression:

Stored size: 810 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?
      branch_opts = "--rev #{branch_name_or_default}"
			token = run("hg id --debug -i -q #{url} #{branch_opts}").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

1 entries across 1 versions & 1 rubygems

Version Path
ohloh_scm-2.5.1 lib/ohloh_scm/adapters/hg/head.rb