Patchwork D8885: merge: use ACTION_* constants instead of values in _filternarrowactions()

login
register
mail settings
Submitter phabricator
Date Aug. 5, 2020, 8:54 a.m.
Message ID <differential-rev-PHID-DREV-jbuhyixdgsnmuaes4ws7-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46983/
State Superseded
Headers show

Comments

phabricator - Aug. 5, 2020, 8:54 a.m.
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  It makes easier to check what noconflicttypes are and which are not included.
  I hope we can have a state where we always use ACTION_* constants instead of
  these values which are very hard to understand.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8885

AFFECTED FILES
  mercurial/merge.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -530,8 +530,18 @@ 
     Raise an exception if the merge cannot be completed because the repo is
     narrowed.
     """
-    nooptypes = {b'k'}  # TODO: handle with nonconflicttypes
-    nonconflicttypes = set(b'a am c cm f g gs r e'.split())
+    # TODO: handle with nonconflicttypes
+    nooptypes = {mergestatemod.ACTION_KEEP}
+    nonconflicttypes = {
+        mergestatemod.ACTION_ADD,
+        mergestatemod.ACTION_ADD_MODIFIED,
+        mergestatemod.ACTION_CREATED,
+        mergestatemod.ACTION_CREATED_MERGE,
+        mergestatemod.ACTION_FORGET,
+        mergestatemod.ACTION_GET,
+        mergestatemod.ACTION_REMOVE,
+        mergestatemod.ACTION_EXEC,
+    }
     # We mutate the items in the dict during iteration, so iterate
     # over a copy.
     for f, action in list(mresult.actions.items()):