comparison 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
comparison
equal deleted inserted replaced
45293:4e6a2889dd1d 45294:30f3e278c5d7
148 extensions, 148 extensions,
149 hg, 149 hg,
150 localrepo, 150 localrepo,
151 match as matchmod, 151 match as matchmod,
152 merge, 152 merge,
153 mergestate as mergestatemod,
153 node as nodemod, 154 node as nodemod,
154 patch, 155 patch,
155 pycompat, 156 pycompat,
156 registrar, 157 registrar,
157 repair, 158 repair,
482 orig, repo, actions, wctx, mctx, overwrite, wantfiledata, **opts 483 orig, repo, actions, wctx, mctx, overwrite, wantfiledata, **opts
483 ): 484 ):
484 if isenabled(repo): 485 if isenabled(repo):
485 manifest = mctx.manifest() 486 manifest = mctx.manifest()
486 files = [] 487 files = []
487 for f, args, msg in actions[b'g']: 488 for f, args, msg in actions[mergestatemod.ACTION_GET]:
488 files.append((f, hex(manifest[f]))) 489 files.append((f, hex(manifest[f])))
489 # batch fetch the needed files from the server 490 # batch fetch the needed files from the server
490 repo.fileservice.prefetch(files) 491 repo.fileservice.prefetch(files)
491 return orig(repo, actions, wctx, mctx, overwrite, wantfiledata, **opts) 492 return orig(repo, actions, wctx, mctx, overwrite, wantfiledata, **opts)
492 493
497 files = [] 498 files = []
498 sparsematch = repo.maybesparsematch(mctx.rev()) 499 sparsematch = repo.maybesparsematch(mctx.rev())
499 for f, (m, actionargs, msg) in pycompat.iteritems(mresult.actions): 500 for f, (m, actionargs, msg) in pycompat.iteritems(mresult.actions):
500 if sparsematch and not sparsematch(f): 501 if sparsematch and not sparsematch(f):
501 continue 502 continue
502 if m in (b'c', b'dc', b'cm'): 503 if m in (
504 mergestatemod.ACTION_CREATED,
505 mergestatemod.ACTION_DELETED_CHANGED,
506 mergestatemod.ACTION_CREATED_MERGE,
507 ):
503 files.append((f, hex(mctx.filenode(f)))) 508 files.append((f, hex(mctx.filenode(f))))
504 elif m == b'dg': 509 elif m == mergestatemod.ACTION_LOCAL_DIR_RENAME_GET:
505 f2 = actionargs[0] 510 f2 = actionargs[0]
506 files.append((f2, hex(mctx.filenode(f2)))) 511 files.append((f2, hex(mctx.filenode(f2))))
507 # batch fetch the needed files from the server 512 # batch fetch the needed files from the server
508 repo.fileservice.prefetch(files) 513 repo.fileservice.prefetch(files)
509 return orig(repo, wctx, mctx, force, mresult, *args, **kwargs) 514 return orig(repo, wctx, mctx, force, mresult, *args, **kwargs)