##// END OF EJS Templates
merge: add a new action type representing files to add/mark as modified...
Siddharth Agarwal -
r27131:d837da26 default
parent child Browse files
Show More
@@ -479,7 +479,10 b' class mergestate(object):'
479 if fcd.isabsent(): # dc: remote picked
479 if fcd.isabsent(): # dc: remote picked
480 action = 'g'
480 action = 'g'
481 elif fco.isabsent(): # cd: local picked
481 elif fco.isabsent(): # cd: local picked
482 action = 'a'
482 if dfile in self.localctx:
483 action = 'am'
484 else:
485 action = 'a'
483 # else: regular merges (no action necessary)
486 # else: regular merges (no action necessary)
484 self._results[dfile] = r, action
487 self._results[dfile] = r, action
485
488
@@ -524,7 +527,7 b' class mergestate(object):'
524
527
525 def actions(self):
528 def actions(self):
526 """return lists of actions to perform on the dirstate"""
529 """return lists of actions to perform on the dirstate"""
527 actions = {'r': [], 'f': [], 'a': [], 'g': []}
530 actions = {'r': [], 'f': [], 'a': [], 'am': [], 'g': []}
528 for f, (r, action) in self._results.iteritems():
531 for f, (r, action) in self._results.iteritems():
529 if action is not None:
532 if action is not None:
530 actions[action].append((f, None, "merge result"))
533 actions[action].append((f, None, "merge result"))
@@ -631,7 +634,7 b' def _checkcollision(repo, wmf, actions):'
631
634
632 if actions:
635 if actions:
633 # k, dr, e and rd are no-op
636 # k, dr, e and rd are no-op
634 for m in 'a', 'f', 'g', 'cd', 'dc':
637 for m in 'a', 'am', 'f', 'g', 'cd', 'dc':
635 for f, args, msg in actions[m]:
638 for f, args, msg in actions[m]:
636 pmmf.add(f)
639 pmmf.add(f)
637 for f, args, msg in actions['r']:
640 for f, args, msg in actions['r']:
@@ -1065,6 +1068,12 b' def applyupdates(repo, actions, wctx, mc'
1065 z += 1
1068 z += 1
1066 progress(_updating, z, item=f, total=numupdates, unit=_files)
1069 progress(_updating, z, item=f, total=numupdates, unit=_files)
1067
1070
1071 # re-add/mark as modified (manifest only, just log it)
1072 for f, args, msg in actions['am']:
1073 repo.ui.debug(" %s: %s -> am\n" % (f, msg))
1074 z += 1
1075 progress(_updating, z, item=f, total=numupdates, unit=_files)
1076
1068 # keep (noop, just log it)
1077 # keep (noop, just log it)
1069 for f, args, msg in actions['k']:
1078 for f, args, msg in actions['k']:
1070 repo.ui.debug(" %s: %s -> k\n" % (f, msg))
1079 repo.ui.debug(" %s: %s -> k\n" % (f, msg))
@@ -1189,6 +1198,13 b' def recordupdates(repo, actions, branchm'
1189 if not branchmerge:
1198 if not branchmerge:
1190 repo.dirstate.add(f)
1199 repo.dirstate.add(f)
1191
1200
1201 # re-add/mark as modified
1202 for f, args, msg in actions.get('am', []):
1203 if branchmerge:
1204 repo.dirstate.normallookup(f)
1205 else:
1206 repo.dirstate.add(f)
1207
1192 # exec change
1208 # exec change
1193 for f, args, msg in actions.get('e', []):
1209 for f, args, msg in actions.get('e', []):
1194 repo.dirstate.normallookup(f)
1210 repo.dirstate.normallookup(f)
@@ -1390,7 +1406,7 b' def update(repo, node, branchmerge, forc'
1390 repo, wc, p2, pas, branchmerge, force, partial, mergeancestor,
1406 repo, wc, p2, pas, branchmerge, force, partial, mergeancestor,
1391 followcopies)
1407 followcopies)
1392 # Convert to dictionary-of-lists format
1408 # Convert to dictionary-of-lists format
1393 actions = dict((m, []) for m in 'a f g cd dc r dm dg m e k'.split())
1409 actions = dict((m, []) for m in 'a am f g cd dc r dm dg m e k'.split())
1394 for f, (m, args, msg) in actionbyfile.iteritems():
1410 for f, (m, args, msg) in actionbyfile.iteritems():
1395 if m not in actions:
1411 if m not in actions:
1396 actions[m] = []
1412 actions[m] = []
@@ -1411,6 +1427,8 b' def update(repo, node, branchmerge, forc'
1411 "use (c)hanged version or (d)elete?"
1427 "use (c)hanged version or (d)elete?"
1412 "$$ &Changed $$ &Delete") % f, 0):
1428 "$$ &Changed $$ &Delete") % f, 0):
1413 actions['r'].append((f, None, "prompt delete"))
1429 actions['r'].append((f, None, "prompt delete"))
1430 elif f in p1:
1431 actions['am'].append((f, None, "prompt keep"))
1414 else:
1432 else:
1415 actions['a'].append((f, None, "prompt keep"))
1433 actions['a'].append((f, None, "prompt keep"))
1416
1434
@@ -725,7 +725,7 b' m "um a c" "um x c" " " "10 do merg'
725 use (c)hanged version or (d)elete? c
725 use (c)hanged version or (d)elete? c
726 preserving b for resolve of b
726 preserving b for resolve of b
727 preserving rev for resolve of rev
727 preserving rev for resolve of rev
728 a: prompt keep -> a
728 a: prompt keep -> am
729 b: both created -> m (premerge)
729 b: both created -> m (premerge)
730 picked tool 'python ../merge' for b (binary False symlink False)
730 picked tool 'python ../merge' for b (binary False symlink False)
731 merging b
731 merging b
General Comments 0
You need to be logged in to leave comments. Login now