674 elif divergent.date() == basedate: |
674 elif divergent.date() == basedate: |
675 date = other.date() |
675 date = other.date() |
676 else: |
676 else: |
677 date = max(divergent.date(), other.date()) |
677 date = max(divergent.date(), other.date()) |
678 |
678 |
679 # new node if any formed as the replacement |
679 # We really want a new commit in order to avoid obsmarker cycles (otherwise |
680 newnode = repo.commit(text=desc, user=user, date=date) |
680 # divergence resolutions done in separate repos may create markers in the |
681 if newnode == divergent.node() or newnode is None: |
681 # opposite directions). For that reason, we set ui.allowemptycommit and |
682 # no changes |
682 # also add also add some salt to the commit extras to make sure we don't |
683 new = divergent |
683 # reuse an existing nodeid. |
684 storemarker = True |
684 with repo.ui.configoverride( |
685 repo.ui.status(_(b"nothing changed\n")) |
685 {(b'ui', b'allowemptycommit'): b'true'}, b'evolve' |
686 hg.updaterepo(repo, divergent.rev(), False) |
686 ): |
|
687 extra = { |
|
688 b'evolve_source_local': divergent.hex(), |
|
689 b'evolve_source_other': other.hex() |
|
690 } |
|
691 newnode = repo.commit(text=desc, user=user, date=date, extra=extra) |
|
692 new = repo[newnode] |
|
693 hg.updaterepo(repo, new.rev(), False) |
|
694 if haspubdiv and publicdiv == divergent: |
|
695 bypassphase(repo, (divergent, new), operation=b'evolve') |
687 else: |
696 else: |
688 new = repo[newnode] |
697 obsolete.createmarkers(repo, [(divergent, (new,))], |
689 newnode = new.node() |
698 operation=b'evolve') |
690 hg.updaterepo(repo, new.rev(), False) |
|
691 if haspubdiv and publicdiv == divergent: |
|
692 bypassphase(repo, (divergent, new), operation=b'evolve') |
|
693 else: |
|
694 obsolete.createmarkers(repo, [(divergent, (new,))], |
|
695 operation=b'evolve') |
|
696 |
699 |
697 # creating markers and moving phases post-resolution |
700 # creating markers and moving phases post-resolution |
698 if haspubdiv and publicdiv == other: |
701 if haspubdiv and publicdiv == other: |
699 bypassphase(repo, (other, new), operation=b'evolve') |
702 bypassphase(repo, (other, new), operation=b'evolve') |
700 else: |
703 else: |