mirror of
https://github.com/valitydev/hellgate.git
synced 2024-11-06 02:45:20 +00:00
BA-43: Checkout party by revision greedily (#172)
This commit is contained in:
parent
442c626dc2
commit
46c7638166
@ -553,13 +553,18 @@ checkout_history_by_timestamp([], _, St) ->
|
||||
checkout_history_by_revision([{_, _, Ev} | Rest], Revision, St) ->
|
||||
St1 = merge_event(Ev, St),
|
||||
case get_st_party(St1) of
|
||||
#domain_Party{revision = Revision} ->
|
||||
{ok, St1};
|
||||
#domain_Party{revision = Revision1} when Revision1 > Revision ->
|
||||
{ok, St};
|
||||
_ ->
|
||||
checkout_history_by_revision(Rest, Revision, St1)
|
||||
end;
|
||||
checkout_history_by_revision([], _, _) ->
|
||||
{error, revision_not_found}.
|
||||
checkout_history_by_revision([], Revision, St) ->
|
||||
case get_st_party(St) of
|
||||
#domain_Party{revision = Revision} ->
|
||||
{ok, St};
|
||||
_ ->
|
||||
{error, revision_not_found}
|
||||
end.
|
||||
|
||||
merge_event(?party_ev(PartyChanges), St) when is_list(PartyChanges) ->
|
||||
lists:foldl(fun merge_party_change/2, St, PartyChanges).
|
||||
|
Loading…
Reference in New Issue
Block a user