Accept an iolist in the revwalk
This commit is contained in:
@@ -28,16 +28,24 @@
|
|||||||
%% @doc Push a commit. This commit and its parents will be included in
|
%% @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
|
%% the walk as long as they haven't been hidden. At least one commit
|
||||||
%% must be pushed before starting a walk.
|
%% must be pushed before starting a walk.
|
||||||
-spec push(pid(), oid()) -> ok | {error, binary()}.
|
-spec push(pid(), oid() | iolist()) -> ok | {error, binary()}.
|
||||||
push(Pid, #oid{oid=Oid}) ->
|
push(Pid, #oid{oid=Oid}) ->
|
||||||
|
gen_server:call(Pid, {push, Oid});
|
||||||
|
push(Pid, Id) ->
|
||||||
|
#oid{oid=Oid} = geef_oid:parse(Id),
|
||||||
gen_server:call(Pid, {push, Oid}).
|
gen_server:call(Pid, {push, Oid}).
|
||||||
|
|
||||||
|
|
||||||
%% @doc Hide a commit. Hide a commit and its parents. Any Parent of
|
%% @doc Hide a commit. Hide a commit and its parents. Any Parent of
|
||||||
%% this commit won't be included in the walk.
|
%% this commit won't be included in the walk.
|
||||||
-spec hide(pid(), oid()) -> ok | {error, binary()}.
|
-spec hide(pid(), oid() | iolist()) -> ok | {error, binary()}.
|
||||||
hide(Pid, #oid{oid=Oid}) ->
|
hide(Pid, #oid{oid=Oid}) ->
|
||||||
|
gen_server:call(Pid, {hide, Oid});
|
||||||
|
hide(Pid, Id) ->
|
||||||
|
#oid{oid=Oid} = geef_oid:parse(Id),
|
||||||
gen_server:call(Pid, {hide, Oid}).
|
gen_server:call(Pid, {hide, Oid}).
|
||||||
|
|
||||||
|
|
||||||
%% @doc Select the sorting method
|
%% @doc Select the sorting method
|
||||||
-spec sorting(pid, atom() | [atom()]) -> ok.
|
-spec sorting(pid, atom() | [atom()]) -> ok.
|
||||||
sorting(Pid, Opts) when is_list(Opts) ->
|
sorting(Pid, Opts) when is_list(Opts) ->
|
||||||
|
|||||||
@@ -26,8 +26,7 @@ count_walk(Walk, Acc) ->
|
|||||||
|
|
||||||
amount_test(Repo) ->
|
amount_test(Repo) ->
|
||||||
{ok, Walk} = geef_repo:revwalk(Repo),
|
{ok, Walk} = geef_repo:revwalk(Repo),
|
||||||
Id = geef_oid:parse("a4a7dce85cf63874e984719f4fdd239f5145052f"),
|
ok = geef_revwalk:push(Walk, "a4a7dce85cf63874e984719f4fdd239f5145052f"),
|
||||||
ok = geef_revwalk:push(Walk, Id),
|
|
||||||
Count = count_walk(Walk, 0),
|
Count = count_walk(Walk, 0),
|
||||||
geef_revwalk:stop(Walk),
|
geef_revwalk:stop(Walk),
|
||||||
[?_assertEqual(6, Count)].
|
[?_assertEqual(6, Count)].
|
||||||
|
|||||||
Reference in New Issue
Block a user