comparison mercurial/sparse.py @ 45339:9320f66854f6

sparse: replace merge action values with mergestate.ACTION_* constants 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. Differential Revision: https://phab.mercurial-scm.org/D8881
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 03 Aug 2020 18:33:00 +0530
parents b9b055f15035
children 3c783ff08d40
comparison
equal deleted inserted replaced
45338:72b8c082676b 45339:9320f66854f6
273 dropped = [] 273 dropped = []
274 tempincludes = readtemporaryincludes(repo) 274 tempincludes = readtemporaryincludes(repo)
275 for file in tempincludes: 275 for file in tempincludes:
276 if file in dirstate and not sparsematch(file): 276 if file in dirstate and not sparsematch(file):
277 message = _(b'dropping temporarily included sparse files') 277 message = _(b'dropping temporarily included sparse files')
278 mresult.addfile(file, b'r', None, message) 278 mresult.addfile(file, mergestatemod.ACTION_REMOVE, None, message)
279 dropped.append(file) 279 dropped.append(file)
280 280
281 mergemod.applyupdates( 281 mergemod.applyupdates(
282 repo, mresult, repo[None], repo[b'.'], False, wantfiledata=False 282 repo, mresult, repo[None], repo[b'.'], False, wantfiledata=False
283 ) 283 )
514 # Add files that are newly included, or that don't exist in 514 # Add files that are newly included, or that don't exist in
515 # the dirstate yet. 515 # the dirstate yet.
516 if (new and not old) or (old and new and not file in dirstate): 516 if (new and not old) or (old and new and not file in dirstate):
517 fl = mf.flags(file) 517 fl = mf.flags(file)
518 if repo.wvfs.exists(file): 518 if repo.wvfs.exists(file):
519 mresult.addfile(file, b'e', (fl,), b'') 519 mresult.addfile(file, mergestatemod.ACTION_EXEC, (fl,), b'')
520 lookup.append(file) 520 lookup.append(file)
521 else: 521 else:
522 mresult.addfile(file, b'g', (fl, False), b'') 522 mresult.addfile(
523 file, mergestatemod.ACTION_GET, (fl, False), b''
524 )
523 added.append(file) 525 added.append(file)
524 # Drop files that are newly excluded, or that still exist in 526 # Drop files that are newly excluded, or that still exist in
525 # the dirstate. 527 # the dirstate.
526 elif (old and not new) or (not old and not new and file in dirstate): 528 elif (old and not new) or (not old and not new and file in dirstate):
527 dropped.append(file) 529 dropped.append(file)
528 if file not in pending: 530 if file not in pending:
529 mresult.addfile(file, b'r', [], b'') 531 mresult.addfile(file, mergestatemod.ACTION_REMOVE, [], b'')
530 532
531 # Verify there are no pending changes in newly included files 533 # Verify there are no pending changes in newly included files
532 abort = False 534 abort = False
533 for file in lookup: 535 for file in lookup:
534 repo.ui.warn(_(b"pending changes to '%s'\n") % file) 536 repo.ui.warn(_(b"pending changes to '%s'\n") % file)