Commit d3e69349 authored by Georges Racinet's avatar Georges Racinet 🦑

Commit API: expose Mercurial changeset IDs

This introduces the `hg_id` and `short_hg_id` fields in the
JSON response.

The difference with `hpd_display_id` and `hpd_short_display_id` (used
in the Web UI) is that they are exposed for Mercurial repositories only.

For Mercurial native projects, these are identical to `id` and `short_id`.

Closes #387

--HG--
branch : heptapod
parent 17c819b95339
......@@ -4,6 +4,12 @@ module API
module Entities
class Commit < Grape::Entity
expose :id, :short_id, :created_at
expose :hg_id, if: lambda { |commit, _options| commit.mercurial? } do |commit, _options|
commit.hgsha
end
expose :short_hg_id, if: lambda { |commit, _options| commit.mercurial? } do |commit, _options|
commit.short_hgsha
end
expose :parent_ids
expose :full_title, as: :title
expose :safe_message, as: :message
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment