sparse: replace merge action values with mergestate.ACTION_* constants
authorPulkit Goyal <7895pulkit@gmail.com>
Mon, 03 Aug 2020 18:33:00 +0530
changeset 45360 9320f66854f6
parent 45359 72b8c082676b
child 45361 cdc50e1929b0
sparse: replace merge action values with mergestate.ACTION_* constants Having bytestrings like `b'r'` makes it hard to understand for people who don't know the code much or looking at it for the first time. Differential Revision: https://phab.mercurial-scm.org/D8881
mercurial/sparse.py
--- a/mercurial/sparse.py	Mon Aug 03 17:58:18 2020 +0530
+++ b/mercurial/sparse.py	Mon Aug 03 18:33:00 2020 +0530
@@ -275,7 +275,7 @@
     for file in tempincludes:
         if file in dirstate and not sparsematch(file):
             message = _(b'dropping temporarily included sparse files')
-            mresult.addfile(file, b'r', None, message)
+            mresult.addfile(file, mergestatemod.ACTION_REMOVE, None, message)
             dropped.append(file)
 
     mergemod.applyupdates(
@@ -516,17 +516,19 @@
         if (new and not old) or (old and new and not file in dirstate):
             fl = mf.flags(file)
             if repo.wvfs.exists(file):
-                mresult.addfile(file, b'e', (fl,), b'')
+                mresult.addfile(file, mergestatemod.ACTION_EXEC, (fl,), b'')
                 lookup.append(file)
             else:
-                mresult.addfile(file, b'g', (fl, False), b'')
+                mresult.addfile(
+                    file, mergestatemod.ACTION_GET, (fl, False), b''
+                )
                 added.append(file)
         # Drop files that are newly excluded, or that still exist in
         # the dirstate.
         elif (old and not new) or (not old and not new and file in dirstate):
             dropped.append(file)
             if file not in pending:
-                mresult.addfile(file, b'r', [], b'')
+                mresult.addfile(file, mergestatemod.ACTION_REMOVE, [], b'')
 
     # Verify there are no pending changes in newly included files
     abort = False