Sha256: dde150652f3ebf2cf052c1c0c5bd1c541c32fa47dd705b187af88f18dcbe9bc8

Contents?: true

Size: 656 Bytes

Versions: 34

Compression:

Stored size: 656 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
        branch_opts = "-r #{ from.branch_name }" if branch_name
				run "cd '#{self.url}' && hg revert --all && hg pull #{ branch_opts } -u -y '#{from.url}'"
			end

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

	end
end

Version data entries

34 entries across 34 versions & 1 rubygems

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