Patchwork D8881: sparse: replace merge action values with mergestate.ACTION_* constants

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

Comments

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

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/sparse.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/sparse.py b/mercurial/sparse.py
--- a/mercurial/sparse.py
+++ b/mercurial/sparse.py
@@ -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