##// END OF EJS Templates
mergeactions: use action constants instead of string values...
Pulkit Goyal -
r45851:30f3e278 default
parent child Browse files
Show More
@@ -150,6 +150,7 b' from mercurial import ('
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,
@@ -484,7 +485,7 b' def applyupdates('
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)
@@ -499,9 +500,13 b' def checkunknownfiles(orig, repo, wctx, '
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
@@ -395,17 +395,17 b' def filterupdatesactions(repo, wctx, mct'
395 files.add(file)
395 files.add(file)
396 if sparsematch(file):
396 if sparsematch(file):
397 prunedactions[file] = action
397 prunedactions[file] = action
398 elif type == b'm':
398 elif type == mergestatemod.ACTION_MERGE:
399 temporaryfiles.append(file)
399 temporaryfiles.append(file)
400 prunedactions[file] = action
400 prunedactions[file] = action
401 elif branchmerge:
401 elif branchmerge:
402 if type != b'k':
402 if type != mergestatemod.ACTION_KEEP:
403 temporaryfiles.append(file)
403 temporaryfiles.append(file)
404 prunedactions[file] = action
404 prunedactions[file] = action
405 elif type == b'f':
405 elif type == mergestatemod.ACTION_FORGET:
406 prunedactions[file] = action
406 prunedactions[file] = action
407 elif file in wctx:
407 elif file in wctx:
408 prunedactions[file] = (b'r', args, msg)
408 prunedactions[file] = (mergestatemod.ACTION_REMOVE, args, msg)
409
409
410 if branchmerge and type == mergestatemod.ACTION_MERGE:
410 if branchmerge and type == mergestatemod.ACTION_MERGE:
411 f1, f2, fa, move, anc = args
411 f1, f2, fa, move, anc = args
@@ -432,7 +432,7 b' def filterupdatesactions(repo, wctx, mct'
432 actions.append((file, (fctx.flags(), False), message))
432 actions.append((file, (fctx.flags(), False), message))
433
433
434 typeactions = mergemod.emptyactions()
434 typeactions = mergemod.emptyactions()
435 typeactions[b'g'] = actions
435 typeactions[mergestatemod.ACTION_GET] = actions
436 mergemod.applyupdates(
436 mergemod.applyupdates(
437 repo, typeactions, repo[None], repo[b'.'], False, wantfiledata=False
437 repo, typeactions, repo[None], repo[b'.'], False, wantfiledata=False
438 )
438 )
@@ -453,9 +453,13 b' def filterupdatesactions(repo, wctx, mct'
453 new = sparsematch(file)
453 new = sparsematch(file)
454 if not old and new:
454 if not old and new:
455 flags = mf.flags(file)
455 flags = mf.flags(file)
456 prunedactions[file] = (b'g', (flags, False), b'')
456 prunedactions[file] = (
457 mergestatemod.ACTION_GET,
458 (flags, False),
459 b'',
460 )
457 elif old and not new:
461 elif old and not new:
458 prunedactions[file] = (b'r', [], b'')
462 prunedactions[file] = (mergestatemod.ACTION_REMOVE, [], b'')
459
463
460 mresult.setactions(prunedactions)
464 mresult.setactions(prunedactions)
461
465
General Comments 0
You need to be logged in to leave comments. Login now