Sha256: ab3b9ea5195e4518cbd90d9678b370476c8353d7c91dc0b6c861d32efb014325

Contents?: true

Size: 800 Bytes

Versions: 15

Compression:

Stored size: 800 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 || :default}"
			token = run("hg id -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

15 entries across 15 versions & 1 rubygems

Version Path
ohloh_scm-2.3.0 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.2.13 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.2.12 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.2.11 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.2.10 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.2.9 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.2.8 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.2.7 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.2.6 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.2.5 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.2.4 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.2.3 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.2.2 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.2.1 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.2.0 lib/ohloh_scm/adapters/hg/head.rb