Sha256: c4609f955db5bd3679424710d923c3333beec1e77fe882939e5b81f11df44988

Contents?: true

Size: 811 Bytes

Versions: 18

Compression:

Stored size: 811 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 --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

18 entries across 18 versions & 1 rubygems

Version Path
ohloh_scm-2.4.14 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.4.13 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.4.12 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.4.11 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.4.10 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.4.9 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.4.8 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.4.7 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.4.6 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.4.5 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.4.4 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.4.3 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.4.1 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.4.0 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.3.5 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.3.4 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.3.2 lib/ohloh_scm/adapters/hg/head.rb
ohloh_scm-2.3.1 lib/ohloh_scm/adapters/hg/head.rb