Page MenuHomePhabricator

copies: handle case when both merge cset are not descendant of merge base
Needs ReviewPublic

Authored by pulkit on Jul 8 2018, 5:11 AM.

Details

Reviewers
None
Group Reviewers
hg-reviewers
Summary

There can be cases when both the changesets which we are merging are not
descendants of the merge base. In those cases dirtyc1 and dirtyc2 both will be
true. The existing code assumes that either of them will be true always but that
is not a right assumption.

I found this while working with content-divergence resolution. In
content-divergence resolution, we use the common predecessor as the merge base
for resolving content divergence and there it can be possible that the merge
base is not the descendant of both the content-divergence changsets.

The code in content-divergence which does this is at:
https://www.mercurial-scm.org/repo/evolve/file/b81fd1487e04/hgext3rd/evolve/evolvecmd.py#l507

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

pulkit created this revision.Jul 8 2018, 5:11 AM
pulkit added inline comments.Jul 8 2018, 5:14 AM
mercurial/copies.py
496

Since we can have both dirtyc1, and dirtyc2 true, I am not sure whether this else should be turned into it's own if statement?

yuja added a subscriber: yuja.Jul 9 2018, 8:23 AM

Can you add some tests that make both dirtyc1 and dirtyc2 set, and
trigger copy tracing?

Since we can have both dirtyc1, and dirtyc2 true, I am not sure whether
this else should be turned into it's own if statement?

No idea. I doubt if the current copy tracing can handle such cases. From
my vague memory, the current algorithm relies on the fact that the pseudo
base revision exists in between the c1 and the c2.

Any updates on this? I'm poking at updating this function in core, and not too excited to have to also modify the copy in evolve that seems to have spawned :/

Any updates on this? I'm poking at updating this function in core, and not too excited to have to also modify the copy in evolve that seems to have spawned :/

I am yet to write tests. Feel free to update the one in core, I will take care of the evolve copy.