Patchwork D8836: largefiles: introduce a constant for 'lfmr' action

login
register
mail settings
Submitter phabricator
Date July 25, 2020, 10:04 a.m.
Message ID <differential-rev-PHID-DREV-jaxh2sinjmi6g7gguvlb-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46907/
State Superseded
Headers show

Comments

phabricator - July 25, 2020, 10:04 a.m.
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  It's better to use a dedicated constant instead of a string which makes pretty
  less sense.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/largefiles/overrides.py

CHANGE DETAILS




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

Patch

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -52,6 +52,8 @@ 
 
 lfstatus = lfutil.lfstatus
 
+MERGE_ACTION_LARGEFILE_MARK_REMOVED = b'lfmr'
+
 # -- Utility functions: commonly/repeatedly needed functionality ---------------
 
 
@@ -495,11 +497,11 @@ 
         orig(ui, repo, *pats, **opts)
 
 
-# Register the `lfmr` merge action in emptyactions() return type
+# Register the MERGE_ACTION_LARGEFILE_MARK_REMOVED in emptyactions() return type
 @eh.wrapfunction(merge, b'emptyactions')
 def overrideemptyactions(origfn):
     ret = origfn()
-    ret[b'lfmr'] = []
+    ret[MERGE_ACTION_LARGEFILE_MARK_REMOVED] = []
     return ret
 
 
@@ -623,7 +625,10 @@ 
                     # "lfile" should be marked as "removed" without
                     # removal of itself
                     mresult.addfile(
-                        lfile, b'lfmr', None, b'forget non-standin largefile',
+                        lfile,
+                        MERGE_ACTION_LARGEFILE_MARK_REMOVED,
+                        None,
+                        b'forget non-standin largefile',
                     )
 
                     # linear-merge should treat this largefile as 're-added'
@@ -639,9 +644,9 @@ 
 
 @eh.wrapfunction(mergestatemod, b'recordupdates')
 def mergerecordupdates(orig, repo, actions, branchmerge, getfiledata):
-    if b'lfmr' in actions:
+    if MERGE_ACTION_LARGEFILE_MARK_REMOVED in actions:
         lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
-        for lfile, args, msg in actions[b'lfmr']:
+        for lfile, args, msg in actions[MERGE_ACTION_LARGEFILE_MARK_REMOVED]:
             # this should be executed before 'orig', to execute 'remove'
             # before all other actions
             repo.dirstate.remove(lfile)