Sha256: 79d7b2d3c9e56bd3b995c0ed4162389a9ddbb93479c4c6153e0cd3a7ef11337a

Contents?: true

Size: 575 Bytes

Versions: 3

Compression:

Stored size: 575 Bytes

Contents

module OhlohScm::Adapters
	class HgAdapter < AbstractAdapter

		def pull(from, &block)
			raise ArgumentError.new("Cannot pull from #{from.inspect}") unless from.is_a?(HgAdapter)
			logger.info { "Pulling #{from.url}" }

			yield(0,1) if block_given? # Progress bar callback

			unless self.exist?
				run "mkdir -p '#{self.url}'"
				run "rm -rf '#{self.url}'"
				run "hg clone -U '#{from.url}' '#{self.url}'"
			else
				run "cd '#{self.url}' && hg revert --all && hg pull -u -y '#{from.url}'"
			end

			yield(1,1) if block_given? # Progress bar callback
		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/pull.rb
ohloh_scm-2.0.1 lib/ohloh_scm/adapters/hg/pull.rb
ohloh_scm-2.0.0 lib/ohloh_scm/adapters/hg/pull.rb