changeset 5559:eb09d05f69f3

evolve: move initial evolvestate values to main function This patch will help us simplify the refactoring in upcoming patches.
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Wed, 05 Aug 2020 14:19:29 +0530
parents 5f2c85ea8b33
children b31cd9ee890a
files hgext3rd/evolve/evolvecmd.py
diffstat 1 files changed, 18 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/evolvecmd.py	Mon Aug 31 15:35:31 2020 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Wed Aug 05 14:19:29 2020 +0530
@@ -289,23 +289,6 @@
 def _prepcontentdivresolution(ui, repo, divergent, other, evolvestate):
     """ if relocation required, decide which divergent cset will be relocated
     to the other side"""
-    evolvestate[b'divergent'] = divergent.node()
-    evolvestate[b'orig-divergent'] = divergent.node()
-    # sometimes we will relocate a node in case of different parents and we can
-    # encounter conflicts after relocation is done while solving
-    # content-divergence and if the user calls `hg evolve --stop`, we need to
-    # strip that relocated commit. However if `--all` is passed, we need to
-    # reset this value for each content-divergence resolution which we are doing
-    # below.
-    evolvestate[b'relocated-other'] = None
-    evolvestate[b'relocating-other'] = False
-    evolvestate[b'relocated-div'] = None
-    evolvestate[b'relocating-div'] = False
-    evolvestate[b'relocation-req'] = False
-    # in case or relocation we get a new other node, we need to store the old
-    # other for purposes like `--abort` or `--stop`
-    evolvestate[b'old-other'] = None
-    evolvestate[b'old-divergent'] = None
 
     # we don't handle merge content-divergent changesets yet
     if len(other.parents()) > 1:
@@ -485,8 +468,26 @@
         ui.write_err(msg)
         return (False, b".")
     other = others[0]
+    evolvestate[b'divergent'] = divergent.node()
     evolvestate[b'other-divergent'] = other.node()
     evolvestate[b'base'] = base.node()
+    evolvestate[b'orig-divergent'] = divergent.node()
+
+    # sometimes we will relocate a node in case of different parents and we can
+    # encounter conflicts after relocation is done while solving
+    # content-divergence and if the user calls `hg evolve --stop`, we need to
+    # strip that relocated commit. However if `--all` is passed, we need to
+    # reset this value for each content-divergence resolution which we are doing
+    # below.
+    evolvestate[b'relocated-other'] = None
+    evolvestate[b'relocating-other'] = False
+    evolvestate[b'relocated-div'] = None
+    evolvestate[b'relocating-div'] = False
+    evolvestate[b'relocation-req'] = False
+    # in case or relocation we get a new other node, we need to store the old
+    # other for purposes like `--abort` or `--stop`
+    evolvestate[b'old-other'] = None
+    evolvestate[b'old-divergent'] = None
 
     # setup everything before merging two content-divergent csets
     datatoproceed = _prepcontentdivresolution(ui, repo, divergent, other,