Sha256: d249437ee1de5c7eb4299950b403b07aec486f62d4a4271a8807a75b9029880f
Contents?: true
Size: 781 Bytes
Versions: 37
Compression:
Stored size: 781 Bytes
Contents
module OhlohScm::Adapters class BzrAdapter < AbstractAdapter def cat_file(commit, diff) cat(commit.token, diff.path) end def cat_file_parent(commit, diff) first_parent_token = parent_tokens(commit).first cat(first_parent_token, diff.path) if first_parent_token end def cat(revision, path) out, err, status = run_with_err("cd '#{url}' && bzr cat --name-from-revision -r #{to_rev_param(revision)} '#{escape(path)}'") return nil if err =~ / is not present in revision / raise RuntimeError.new(err) unless status == 0 out end # Bzr doesn't like it when the filename includes a colon # Also, fix the case where the filename includes a single quote def escape(path) path.gsub(/[:]/) { |c| '\\' + c }.gsub("'", "''") end end end
Version data entries
37 entries across 37 versions & 1 rubygems