Sha256: 1898ed75ce59d7aeb50cab67b63b4d1006d433fe6f63f5e758e09d749d693381

Contents?: true

Size: 883 Bytes

Versions: 3

Compression:

Stored size: 883 Bytes

Contents

module OhlohScm::Adapters
	class BzrAdapter < AbstractAdapter
		def exist?
			begin
				head_token.to_s.length > 0
			rescue
				logger.debug { $! }
				false
			end
		end

		def ls_tree(token)
			run("cd #{path} && bzr ls -V -r #{to_rev_param(token)}").split("\n")
		end

		def to_rev_param(r=nil)
			case r
			when nil
				1
			when Fixnum
				r.to_s
			when /^\d+$/
				r
			else
        "'revid:#{r.to_s}'"
			end
		end

		def is_merge_commit?(commit)
			parent_tokens(commit).size > 1
		end

		def export(dest_dir, token=head_token)
			# Unlike other SCMs, Bzr doesn't simply place the contents into dest_dir.
			# It actually *creates* dest_dir. Since it should already exist at this point,
			# first we have to delete it.
			Dir.delete(dest_dir) if File.exist?(dest_dir)

			run "cd '#{url}' && bzr export --format=dir -r #{to_rev_param(token)} '#{dest_dir}'"
		end
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ohloh_scm-2.1.0 lib/ohloh_scm/adapters/bzr/misc.rb
ohloh_scm-2.0.1 lib/ohloh_scm/adapters/bzr/misc.rb
ohloh_scm-2.0.0 lib/ohloh_scm/adapters/bzr/misc.rb