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

Re: [MirageOS-devel] Merging in Irmin



>>> Not sure how to expose that nicely to the user though... maybe allowing to 
>>> specify a "parent" optional argument to merge/update/rebase.
> 
> That would be useful. I've been avoiding the "Private" API so far, but
> maybe I should start using it.

I've just open a new PR to fix that: https://github.com/mirage/irmin/pull/178

I've exposed `View.parents` and `View.set_parents` to do that. I'm not very 
happy with that API: on one hand, it would be much better to have immutable 
views (and have `with_parents` to modify the parents), but on the other hand, 
the current APIs is nice because it is a subset of Irmin.S so I kept exposing 
the side-effects...

>> You can only create a view from one store and apply it in the other: the 
>> history of commit will be kept as expected. See:
>> 
>> https://github.com/samoht/dog/blob/master/lib/dog.ml#L247
>> 
>> You can try to use that to merge views from different branches, not sure how 
>> practical this is though.
> 
> The basic logic I have is roughly:
> 
> 1. git checkout base
> 2. (apply modification)
> 3. UPDATE=$(git commit-tree -p base)
> 4. git checkout master
> 5. git-merge -s custom $UPDATE
> 
> Where "custom" should be my app-specific merge logic that works on
> whole trees rather than individual files.

So now you should be able to create a view, do some stuff on it, give it the 
parents you need and save it.

> 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.

Let me know if you need something else (I'm still working on the right way to 
fix the watch API).

Best,
Thomas


_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel


 


Rackspace

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