evolve: if required, rebase backward when resolving content divergence
This patch makes some update in logic of content-divergence resolution. Before this patch, we always set the parent of ahead one (from the two divergent cset) as resolution parent and then make sure both are located on resolution parent and perform 3-way merge to get resultant cset. But now, if the reason behind content-divergence is that one side amended some content changes while other moved backward in the dag (relocated on one of its ancestor); we set the parent of relocated one as resolution parent and then make sure both are on resolution parent and perform 3-way merge. Note: this change covers the backward movement only for the case when the moved cset is a direct child to one of its current parent's ancestor. To check if one of the divergent cset was rebased backward we check if `gca` is present in the ancestors of base i.e. `::base` because if we rebase a cset backward it would become a child of one of its current parent's ancestor. For e.g. ``` .. D' D .. \ | .. C .. | .. B D'' .. | / .. A .. | .. ● O ``` Here `D'` and `D''` are divergent from each other, where `D''` rebased backward and `D'` amended some changes. So here if we see the range `::base` i.e. `::D` contains `gca` i.e. `A`. Following is the check which help us to find out if one of the divergent cset was rebased backward: if gca in repo.revs(b'(::%d)-(%d)', basep1, basep1) Where, gca: greatest common ancestor of two divergent changesets basep1: p1 of base of two divergent changesets ``` .. C'' .. | .. C' B C .. \ | / .. A .. | .. ● O ``` Above graph will help us understand revset clearly: 1) Obviously we are checking presence of gca in the ancestors of basep1 2) But you might be thinking why base.p1() instead of base: because it filters false-positive for e.g. in above graph it would have considered it as a backward rebase if it was `::C` (::base) instead of `::A` (::basep1) , as you can see `::C` contains A. But it still give false positive because `::A` contains the basep1 i.e. A, which is why we do `(::basep1) - basep1` Changes is test files reflect the changed behavior.