Sha256: 957abf68d99255712b22c7c8a610b459ba97aaff3e0196875bf988a503d2edb3
Contents?: true
Size: 653 Bytes
Versions: 34
Compression:
Stored size: 653 Bytes
Contents
require 'shellwords' module OhlohScm::Adapters class HgAdapter < AbstractAdapter def cat_file(commit, diff) cat(commit.token, diff.path) end def cat_file_parent(commit, diff) p = parent_tokens(commit) cat(p.first, diff.path) if p.first end def cat(revision, path) out, err = run_with_err("cd '#{url}' && hg cat -r #{revision} #{escape(path)}") return nil if err =~ /No such file in rev/i raise RuntimeError.new(err) unless err.to_s == '' out end # Escape bash-significant characters in the filename # Example: # "Foo Bar & Baz" => "Foo\ Bar\ \&\ Baz" def escape(path) path.shellescape end end end
Version data entries
34 entries across 34 versions & 1 rubygems