Sha256: 1e632ad0614da52bd4dcc6d1d0a12188a38e35b16603979d36e2e6f63d2478a9

Contents?: true

Size: 965 Bytes

Versions: 16

Compression:

Stored size: 965 Bytes

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|
        tag_name, rev_number_and_hash = tag_string.split(/\s+/)
        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

16 entries across 16 versions & 1 rubygems

Version Path
ohloh_scm-2.4.0 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.3.5 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.3.4 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.3.2 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.3.1 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.3.0 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.2.13 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.2.12 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.2.11 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.2.10 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.2.9 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.2.8 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.2.7 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.2.6 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.2.5 lib/ohloh_scm/adapters/hg/misc.rb
ohloh_scm-2.2.4 lib/ohloh_scm/adapters/hg/misc.rb