Sha256: 1786743c102215c5f011bde8cdcf7f8dcf237d69a20e59a4016b6ead42141069

Contents?: true

Size: 1 KB

Versions: 13

Compression:

Stored size: 1 KB

Contents

module OhlohScm::Adapters
	class HgAdapter < AbstractAdapter
		def exist?
			begin
				!!(head_token)
			rescue
				logger.debug { $! }
				false
			end
		end

		def ls_tree(token)
			run("cd '#{path}' && hg manifest -r #{token} | #{ string_encoder }").split("\n")
		end

		def export(dest_dir, token='tip')
			run("cd '#{path}' && hg archive -r #{token} '#{dest_dir}'")
			# Hg leaves a little cookie crumb in the export directory. Remove it.
			File.delete(File.join(dest_dir, '.hg_archival.txt')) if File.exist?(File.join(dest_dir, '.hg_archival.txt'))
		end

    def tags
      tag_strings = run("cd '#{path}' && hg tags").split(/\n/)
      tag_strings.map do |tag_string|
        parsed_str = tag_string.split(' ')
        rev_number_and_hash = parsed_str.pop
        tag_name = parsed_str.join(' ')
        rev = rev_number_and_hash.slice(/\A\d+/)
        time_string = run("cd '#{ path }' && hg log -r #{ rev } | grep 'date:' | sed 's/date://'")
        [tag_name, rev, Time.parse(time_string)]
      end
    end
	end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ohloh_scm-2.4.14 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.4.13 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.4.12 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.4.11 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.4.10 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.4.9 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.4.8 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.4.7 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.4.6 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.4.5 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.4.4 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.4.3 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.4.1 lib/ohloh_scm/adapters/hg/misc.rb