diff hgext/remotefilelog/__init__.py @ 45294:30f3e278c5d7

mergeactions: use action constants instead of string values Having constants inplace of strings like 'c', 'cm' etc. makes it easier to understand the code. Differential Revision: https://phab.mercurial-scm.org/D8832
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 24 Jul 2020 23:40:07 +0530
parents 4ad6c4e9e35f
children b9b055f15035
line wrap: on
line diff
--- a/hgext/remotefilelog/__init__.py	Sun Aug 02 10:24:28 2020 -0700
+++ b/hgext/remotefilelog/__init__.py	Fri Jul 24 23:40:07 2020 +0530
@@ -150,6 +150,7 @@
     localrepo,
     match as matchmod,
     merge,
+    mergestate as mergestatemod,
     node as nodemod,
     patch,
     pycompat,
@@ -484,7 +485,7 @@
     if isenabled(repo):
         manifest = mctx.manifest()
         files = []
-        for f, args, msg in actions[b'g']:
+        for f, args, msg in actions[mergestatemod.ACTION_GET]:
             files.append((f, hex(manifest[f])))
         # batch fetch the needed files from the server
         repo.fileservice.prefetch(files)
@@ -499,9 +500,13 @@
         for f, (m, actionargs, msg) in pycompat.iteritems(mresult.actions):
             if sparsematch and not sparsematch(f):
                 continue
-            if m in (b'c', b'dc', b'cm'):
+            if m in (
+                mergestatemod.ACTION_CREATED,
+                mergestatemod.ACTION_DELETED_CHANGED,
+                mergestatemod.ACTION_CREATED_MERGE,
+            ):
                 files.append((f, hex(mctx.filenode(f))))
-            elif m == b'dg':
+            elif m == mergestatemod.ACTION_LOCAL_DIR_RENAME_GET:
                 f2 = actionargs[0]
                 files.append((f2, hex(mctx.filenode(f2))))
         # batch fetch the needed files from the server