Namespace the records

This makes it useful for users of the bindings. The naming is the same
as the module to allow elixir to treat the records in much the same
way as its native module/record hybrid.
This commit is contained in:
Carlos Martín Nieto
2013-05-13 10:55:18 +02:00
parent cc8124a6b9
commit 4a2f2e8ab2
12 changed files with 83 additions and 92 deletions

View File

@@ -28,21 +28,21 @@
%% @doc Push a commit. This commit and its parents will be included in
%% the walk as long as they haven't been hidden. At least one commit
%% must be pushed before starting a walk.
-spec push(pid(), oid() | iolist()) -> ok | {error, binary()}.
push(Pid, #oid{oid=Oid}) ->
-spec push(pid(), geef_oid() | iolist()) -> ok | {error, binary()}.
push(Pid, #geef_oid{oid=Oid}) ->
gen_server:call(Pid, {push, Oid});
push(Pid, Id) ->
#oid{oid=Oid} = geef_oid:parse(Id),
#geef_oid{oid=Oid} = geef_oid:parse(Id),
gen_server:call(Pid, {push, Oid}).
%% @doc Hide a commit. Hide a commit and its parents. Any Parent of
%% this commit won't be included in the walk.
-spec hide(pid(), oid() | iolist()) -> ok | {error, binary()}.
hide(Pid, #oid{oid=Oid}) ->
-spec hide(pid(), geef_oid() | iolist()) -> ok | {error, binary()}.
hide(Pid, #geef_oid{oid=Oid}) ->
gen_server:call(Pid, {hide, Oid});
hide(Pid, Id) ->
#oid{oid=Oid} = geef_oid:parse(Id),
#geef_oid{oid=Oid} = geef_oid:parse(Id),
gen_server:call(Pid, {hide, Oid}).
@@ -118,7 +118,7 @@ code_change(_OldVsn, State, _Extra) ->
handle_next(Handle) ->
case geef_nif:revwalk_next(Handle) of
{ok, Oid} ->
{ok, #oid{oid=Oid}};
{ok, #geef_oid{oid=Oid}};
Other ->
Other
end.