[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MirageOS-devel] Merging in Irmin

> I'm not sure how to use this. It looks like parents is only used in
> merge_path. How do I use it with update_path?
> Ideally, I think I want something like:
>  BC.make_head :
>    Irmin.config -> ('a -> Irmin.task) -> parents:head list ->
>    msg:'a -> View.t -> ('a -> t) Lwt.t
> to implement CueKeeper's API:
>  module Commit : sig
>    type t
>    val commit :
>      parents:t list ->
>      Staging.t ->
>      msg:string ->
>      t Lwt.t
> How can I take two commits, generate a view (manually) with the
> results of my custom merge, and then add the result as a new commit
> with both of the original parents?

Something like:

let commit ~parents staging ~msg =
      match staging.Staging.commit with
      | None -> assert false
      | Some t ->
      I.of_head t.c_repo.config t.c_repo.task_maker (id t) >>= fun tmp_branch ->
      (* THE ONLY CHANGE *) V.set_parents Staging.view parents;
      V.update_path (tmp_branch msg) I.Key.empty staging.Staging.view >|= fun 
() ->
      {t with c_store = tmp_branch}

I'll see if I can add your `make_head` function.


>>> Currently, I merge to create a new commit, test it, and then do a
>>> fast-forward to update the branch to include the merge if the test
>>> passes. But if I can use custom merge code, then it would be OK to
>>> merge directly to the branch when my merge code returns, since it will
>>> already have had a chance to test it.
>> In the PR, I've also added `Irmin.fast_forward_head` (maybe it should be 
>> `fast_forward_to_head`?) to to that. It returns "false" (and does nothing) 
>> it the new head is not strictly in the future of the current head.
> Thanks! [ As noted elsewhere, it would be useful to distinguish the
> case where it's already up-to-date (success; no futher action needed)
> from the case where it's not an ancestor (failure; retry merge with
> new head). ]
>> Let me know if you need something else (I'm still working on the right way 
>> to fix the watch API).
>> Best,
>> Thomas
> -- 
> Dr Thomas Leonard        http://0install.net/
> GPG: 9242 9807 C985 3C07 44A6  8B9A AE07 8280 59A5 3CC1
> GPG: DA98 25AE CAD0 8975 7CDA  BD8E 0713 3F96 CA74 D8BA

MirageOS-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.