[Proposal] Auto merge mix.lock when there are merge conflicts

90 views
Skip to first unread message

Allen Madsen

unread,
Sep 7, 2017, 7:54:41 PM9/7/17
to elixir-lang-core
Yarn 1.0 was released today and in the blog post they mention that they've added auto merge for yarn.lock files [1]. Having run into this issue and resolved it manually, I can attest to how painful it is. So, I'd like to propose we bring this feature to mix deps.

José Valim

unread,
Sep 7, 2017, 9:06:07 PM9/7/17
to elixir-l...@googlegroups.com
That's an interesting feature. Does anyone have more information on how the merging actually works? Depending if you are rebasing or merging the direction on Git changes so it seems we can't simply pick what comes first or what comes later, can we?
--


José Valim
Skype: jv.ptec
Founder and Director of R&D

Allen Madsen

unread,
Sep 8, 2017, 7:39:20 AM9/8/17
to elixir-l...@googlegroups.com
I haven't looked too much myself, but this is the PR that added it. https://github.com/yarnpkg/yarn/pull/3544/files

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4K7LCpnBqCh4f8L_TBmWEqh_6G575h3-L24AYRzfB6SKg%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

José Valim

unread,
Sep 8, 2017, 8:10:53 AM9/8/17
to elixir-l...@googlegroups.com
The tests in the PR seem to assume that:

1. HEAD comes first, which is not true for many Git workflows
2. That the conflict happens in separate packages

It seems there has not been a discussion of all the possible corner cases.

Further thoughts?




José Valim
Skype: jv.ptec
Founder and Director of R&D

Allen Madsen

unread,
Sep 8, 2017, 8:44:37 PM9/8/17
to elixir-l...@googlegroups.com
I haven't looked deeply into their algorithm. It's very possible it has issues.

Sort of abstractly, the way I would approach it is:

1. Reconcile things to the pre merge state version of the files, so they can be parsed. That would mean always pick incoming for one version and always pick base for the other version. 
2. Do a structured diff of the two structures to figure out what varied. 
3. Generate one permutation of versions by using a set of heuristics. (e.g. pick the newest, include additions, etc)
4. Then I would validate that the permutation is valid.
5. If it's valid, it's done, if it's not, go back to step 3, if all the permutations were tried and none were valid, bail out.

Finally, if there are some edge cases that aren't handled, bail out and state why. 

This feels like something that doesn't need to be perfect from the beginning. Just good enough.


José Valim

unread,
Sep 9, 2017, 12:45:56 AM9/9/17
to elixir-l...@googlegroups.com
If we do the merging choosing the ones that match the current requirements then it can work, yeah. Can you please open up an issue so we track it?

To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAK-y3CsAkazsf3NiQ4krxVLNObUnbg9weYH_tRP-7u8YYqm1cw%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.
--

Allen Madsen

unread,
Sep 9, 2017, 9:02:06 AM9/9/17
to elixir-l...@googlegroups.com
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
--


José Valim
Skype: jv.ptec
Founder and Director of R&D

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2B9%3DYtgC-qx2PZ4iBx7438nYkz3dRL_m_PLB_Nkg3EiSA%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages