# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1595668469 -19800 # Node ID a3cd63d6005bef3e4ccaa1119f62d30912fe86de # Parent ab57793dec5b765cbff11074e0827a6f40cb3896 largefiles: introduce a constant for 'lfmr' action It's better to use a dedicated constant instead of a string which makes pretty less sense. Differential Revision: https://phab.mercurial-scm.org/D8836 diff -r ab57793dec5b -r a3cd63d6005b hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py Sat Jul 25 14:41:20 2020 +0530 +++ b/hgext/largefiles/overrides.py Sat Jul 25 14:44:29 2020 +0530 @@ -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)